0% found this document useful (0 votes)
7 views70 pages

k8s Ansible

The document discusses the integration of Kubernetes and Ansible for automating the deployment and management of applications in a scalable manner. It highlights the challenges faced during deployment, such as managing container orchestration and ensuring consistent configurations across nodes, and provides solutions using Ansible playbooks. The document also explains key concepts of Kubernetes architecture, including pods, nodes, and clusters, as well as service types for network communication.

Uploaded by

mariem Beny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views70 pages

k8s Ansible

The document discusses the integration of Kubernetes and Ansible for automating the deployment and management of applications in a scalable manner. It highlights the challenges faced during deployment, such as managing container orchestration and ensuring consistent configurations across nodes, and provides solutions using Ansible playbooks. The document also explains key concepts of Kubernetes architecture, including pods, nodes, and clusters, as well as service types for network communication.

Uploaded by

mariem Beny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 70

Kubernete

s an
d
Ansible
:
Introduction
The catch:

you’re preparing a 10-course


meal with different cuisines
The catch:

Some guests are vegetarian,


some are gluten-free, and
some have nut allergies
The catch:

Halfway through the party,


more people show up
unexpectedly, and you need to
scale up the food and seating
The catch:

and your oven breaks down


mid-party
The Secret Sauce to Smooth Operations
The Secret Sauce to Smooth Operations

It automatically manages all the


dishes (applications), making
sure they’re cooked, served,
and scaled to perfection—even
when unexpected guests arrive
or oven breaks. It ensures
everything runs smoothly, no
matter what happens.
master chef and event coordinator
The Secret Sauce to Smooth Operations

It automates all the repetitive


tasks—chopping vegetables,
preheating the oven, setting the
table—so you don’t have to do
everything manually. It ensures
consistency across every dish,
so every guest gets exactly
what they ordered.
prep kitchen and recipe book
Kubernete
s
So many
questions
What is it? Why even bother?
It’s really complicated
Kubernete
s
Orchestration
tool
Used for large scale
deployments
It excels in
production
Used extensively by
big tech
Why k8s*?

* Short for Kubernetes


Why k8s?

Let’s imagine we have an


application
Why k8s?

Let’s imagine we have an


application
Why k8s?
Why k8s?

And it’s running on


so many containers
Why k8s?

At a certain point the management of the


containers becomes really difficult and
chaotic
Why k8s?
:)))))

Kubernetes manages the orchestration of


these containers perfectly
Before diving deeper, let’s get
familiar with some concepts
Pods, nodes, clusters
Pod
Pod
smallest and simplest unit in the
Kubernetes object model
It represents a single instance of a
running process
Single or
multiple
containers
Single or ephemeral
multiple
containers
Single or
ephemeral Has its own IP
multiple
address
containers
Physical or virtual machines that
provide the resources to run
applications
Cluster

The foundation of the K8s architecture


Cluster

Master node Worker node


Cluster

Master node Worker node


Master node *

Api
server

Front-end for the


control plane

Exposes the K8s api to


perform operation on
the cluster

* Control plane is the same as master node


Master node *

Scheduler

Assigns Pods to Nodes


based on resource
availability and constraints

* Control plane is the same as master node


Master node *

Controller
manager

Runs controllers that


regulate the state of the
cluster (e.g., Node
Controller, Replication
Controller)

* Control plane is the same as master node


Master node *

Cloud Controller
manager

handles cloud provider-


specific logic, enabling
seamless integration with
underlying cloud
infrastructure

* Control plane is the same as master node


Master node *

etcd

Highly available key value


store for all the cluster
data

* Control plane is the same as master node


worker node

Kubelet

agent that runs on each


node in the cluster. It
ensures that containers
are running in a Pod.

Worker node
worker node

K8s proxy

Maintains network rules on


nodes. These rules allow
communication to Pods
from network sessions
inside or outside the
cluster

Worker node
Service Types

clusterIP NodePort
Exposes the service on th Exposes the service on a static
cluster internal ip address port on the node’s ip address

Ingress
LoadBalancer controller
Exposes the service externally using a (not really a service type) but a really
cloud provider's load balancer advanced and a smart way to route
traffic and provide loadbalancing but
it’s hard to setup
Used to automate the deployment and
management of systems
Steps to automate a deployment
It can be applied to set up a Kubernetes
cluster efficiently
Playbooks are files that contain a list of
tasks to be executed on machines
Ansible installs necessary software like
Docker and kubeadm on nodes
It initializes the master node to create
the Kubernetes cluster
Ansible runs commands to add worker
nodes to the cluster
It installs networking plugins to enable
communication between nodes
Step by step K8s cluster deployment

inventory ssh

push

Master node Worker node


playbook
inventory
Step by step K8s cluster deployment

inventory ssh

push

Master node Worker node


playbook
playbook
Challenge

nodes have consistent OS settings,


networking, and dependencies
Solution
Challenge

nodes have consistent OS settings, Playbooks to enforce setup.


networking, and dependencies
Roles and variables to manage different
OS versions efficiently.
Challenge

Container Network Interface


plugin required.
Misconfigured networking
Solution
Challenge

Container Network Interface plugin


required.
Misconfigured networking Automate CNI plugin installation
Validate connectivity after
deployment.
Challenge

Expired or misconfigured TLS


certificates can break cluster
communication.
Solution
Challenge

Expired or misconfigured TLS


certificates can break cluster
communication. Use Kubeadm to manage certificates
Ansible Vault to encrypt secrets.
conclusion

You might also like