Kubernetes Workflow Kubernetes Workflow 

Last Updated on October 18, 2023 by Arnav Sharma

So what exactly is Kubernetes? Kubernetes (also known as K8s) is open-source software for deploying, scaling and managing containerized applications.

As an automation solution, Kubernetes handles the work of deploying and managing the workloads to ensure they run as you intended.

Then where does Docker comes from?

Docker is a containerization platform, and Kubernetes is a container orchestrator for container platforms like Docker. 

Docker = Container

Kubernetes = To Automate Containers ?

Just to keep things simple – consider the analogy of “VMWare Solution and Kubernetes”

Both are different products and have different offerings, but in case you have worked with VMWare suit or even Hyper-V, this will make things simpler.

In VMWare, we have a vCentre Server that manages VMWare ESXi hosts and these hosts are then responsible for managing./hosting the VM’s. In case you want to deploy a VM on host # 3, you login to the vCentre and do some magic (via UI or command line) and deploy whatever is needed (Simple?)

So, vCentre is basically the interface or the main contact point to interact with the VMWare hosts or the VM’s.

Coming on to Kubernetes, which is the next level of virtualization, we can assume a similar scenario.

The master can be your vCentre Server which is responsible for the management of the work nodes (think about ESXi hosts). So, in case you want to deploy a new worker node, you do it via the master node or you want to deploy a container (a docker container), you do it via master. Pretty similar to doing things via vCentre sever but not doing anything on vCentre server itself but on the hosts.

The concept of vCentre vs Kubernetes helps us to understand things easily, however, these are two different things that have completely different underlying technology.

So let’s get started with the Kubernetes Components:

Control Plane Components (Master Node)

  • Api Server: Acts as frontend for Kubernetes – interaction via UI, command line etc. The API server is responsible for tasks like: Request Validation, Data Retrieval, Update ETCD, Scheduler, Authenticating Users and Kubelet.
  • Etcd: Key-Value storage for cluster configuration. Consistent and highly available key value store used as Kubernetes’ backing store for all cluster data. If your Kubernetes cluster uses etcd as its backing store, make sure you have a back up plan for those data
  • Scheduler: Managing containers across nodes. Control plane component that watches for newly created Pods with no assigned node, and selects a node for them to run on. Factors taken into account for scheduling decisions include: individual and collective resource requirements, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference, and deadlines
  • Controller: Control plane component that runs controller processes. It’s the brain behind working of containers and acts accordingly. Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process.

Node Components (Worker Node):

  • Kubelet: An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod. Ensure that containers are running on nodes as expected.
  • Container runtime: The container runtime is the software that is responsible for running containers. Like docker, rkt etc.

Pods:

  • The smallest unit in Kubernetes.
  • 1:1 relation with container
  • The pod is a single instance of an application.
  • Pod usually contains one application.
  • Or may have more applications as well – like a helper container.  

Additional components:

Replica Sets (old name: Replication Controller)

  • Used for High Availability
  • Used Load balancing and Scaling of pods.

Services:

  • Help connecting apps with each other.
  • Helps connect users externally with apps.

Service Types:

  • Node Port (External Access to Apps)
  • Cluster IP (Virtual IP of the cluster)
  • Load Balancer. (Multiple Instances behind an LB – cloud concept)

Namespace:

  • A way to segregate the environments.
  • Help to isolate the services – Prod, Dev, Test etc.
  • Switching can be done from the default namespace.

Scheduling:

  • Allocate pods to nodes.
  • Can be done manually by assigning the node name.
  • The exiting pod can’t be assigned to the node.

Labels and Selectors:

  • Labels are properties attached to each item.
  • Group objects by type (pod, replica sets etc) or by application (app1, app2 etc)
  • Definition file à Under metadata à create labels à add key-value paid
  • Can also be used to connect services together (like pods attached to replica sets)

Taint and Tolerations:

  • Taint can be used to specify what pods can be deployed on a specific node.
  • Pods will accept the pods with certain tolerations.
  • Specified by using key-value pair.

Node Selectors and Affinity

  • To run a pod on a specific node.
  • First, label the node and use that label in the definition file to deploy pod in specific node.
  • Add a nodeSelector property in the specs section and then
  • Selectors are limited to key-value pair – so affinity helps here to have “or” and “and” rules.
  • Example for Affinity – to place the pod on either medium or small node.

Daemon Sets:

  • Similar to Replica Sets
  • DS ensure that one copy of pods is always available in all the available nodes.
  • Uses cases – Monitoring solution or logging agent or kube proxy.


Q: How can I get started with Kubernetes?

A: To get started with Kubernetes, you can follow a kubernetes tutorial, learn kubernetes concepts, and leverage tools like minikube and kubectl. The official kubernetes documentation also provides a guide to getting started.

Q: What is the underlying architecture of Kubernetes?

A: The underlying kubernetes architecture includes components like the kubernetes control plane, kubernetes api, and various kubernetes resources. It focuses on orchestrating containers using a desired state defined in yaml files.

Q: Why is Kubernetes important in the DevOps realm?

A: Kubernetes is vital in the devops field because it is an open-source container orchestration system. It facilitates the deployment, scaling, and management of applications, bridging the gap between development and operations.

Q: How does Kubernetes manage container deployment?

A: Kubernetes manages container deployment using kubernetes deployment objects, kubectl commands, and yaml file definitions. It ensures that the desired state of applications is maintained within the cluster.

Q: Can you explain some core Kubernetes concepts?

A: Core kubernetes concepts include pod, replica, deployment, persistent volume, and kubernetes service. These are foundational elements for application development and deployment within the Kubernetes environment.

Q: How does communication with the Kubernetes cluster occur?

A: Communication with the kubernetes cluster is facilitated by the kubernetes api, which exposes the kubernetes api to users. It allows for interactions both within the cluster and outside the cluster.

Q: What are the main features of Kubernetes?

A: Features of kubernetes include container orchestration, auto-scaling, self-healing, service discovery, and load balancing. Kubernetes also provides persistent volume support, allowing for stateful application management.

Q: How do I deploy an application using Kubernetes?

A: To deploy applications on Kubernetes, you can use the kubectl command-line tool, define your application in a yaml file, and leverage kubernetes deployment resources. The desired state specified in the yaml is then actualized by Kubernetes.

Q: Which cloud providers support Kubernetes?

A: Kubernetes is supported by various cloud providers, including google cloud and kubernetes on aws. Many providers offer managed kubernetes services, simplifying the process of running a kubernetes cluster in the cloud.

Q: What’s the difference between Docker and Kubernetes?

A: Docker is a container engine that allows you to package and run the container. In contrast, Kubernetes is an open-source system that manages, scales, and orchestrates those containers in a cluster environment. While Docker focuses on individual containers, Kubernetes focuses on the orchestration of multiple containers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Toggle Dark Mode