What is Kubernetes? And why do we call it k8s?
Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery.
The name Kubernetes originates from Greek, meaning helmsman or pilot. K8s as an abbreviation results from counting the eight letters between the "K" and the "s".
Key Features of Kubernetes
Feature | Resulting Benefit |
Scalability | Ability to manage workloads of any size, across infrastructures of any size. |
Container Orchestration | By offloading container provisioning, deployment and scaling to Kubernetes, teams can work more efficiently at scale. |
Storage Orchestration | Kubernetes makes it easy to connect containers to a variety of storage resources. |
Self-healing | Automatic recovery from routine failures reduces workload downtime and disruption to users. |
Service Discovery and Load Balancing | Admins don't have to configure network services and load balancing manually. |
Rolling Updates and Rollbacks | Teams can update applications, or revert to an earlier release in response to a bug, without downtime. |
Kubernetes Architecture
A Kubernetes cluster is composed of two separate planes:
Kubernetes Control plane: The control plane manages the worker nodes and the Pods in the cluster.
Kubernetes Data plane: Data plane consists of a set of worker machines, called nodes, that run containerized applications. Every cluster has at least one worker node. The worker node(s) host the Pods that are the components of the application workload.
Control Plane Components :
kube-apiserver:
The API server is a component of the Kubernetes control plane that exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.
The Kubernetes API server validates and configures data for the API objects which include pods, services, replicationControllers, and others.
etcd
Consistent and highly-available key value store used as Kubernetes' backing store for all cluster data.
kube-scheduler
Control plane component that watches for newly created Pods with no assigned node, and selects a node for them to run on.
kube-controller-manager
Control plane component that runs controller processes.
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.
There are many different types of controllers. Some examples of them are:
Node controller: Responsible for noticing and responding when nodes go down.
Job controller: Watches for Job objects that represent one-off tasks, then creates Pods to run those tasks to completion.
EndpointSlice controller: Populates EndpointSlice objects (to provide a link between Services and Pods).
ServiceAccount controller: Create default ServiceAccounts for new namespaces
cloud-controller-manager
A Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.
The cloud-controller-manager only runs controllers that are specific to your cloud provider. If you are running Kubernetes on your own premises, or in a learning environment inside your own PC, the cluster does not have a cloud controller manager.
The following controllers can have cloud provider dependencies:
Node controller: For checking the cloud provider to determine if a node has been deleted in the cloud after it stops responding
Route controller: For setting up routes in the underlying cloud infrastructure
Service controller: For creating, updating and deleting cloud provider load balancers
Data Plane/Node Components :
Node components run on every node, maintaining running pods and providing the Kubernetes runtime environment.
kubelet
An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod.
The kubelet takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn't manage containers which were not created by Kubernetes.
kube-proxy
kube-proxy is a network proxy that runs on each node in your cluster, implementing part of the Kubernetes Service concept.
kube-proxy maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster.
Container runtime
A fundamental component that empowers Kubernetes to run containers effectively. It is responsible for managing the execution and lifecycle of containers within the Kubernetes environment.
Kubernetes supports container runtimes such as containerd, CRI-O, and any other implementation of the Kubernetes CRI (Container Runtime Interface).
Command line tool (kubectl)
Kubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API. This tool is named kubectl
.
For configuration, kubectl
looks for a file named config
in the $HOME/.kube
directory. You can specify other kubeconfig files by setting the KUBECONFIG
environment variable or by setting the --kubeconfig
flag.
Difference between kubectl and kubelet.
Kubectl is the Kubernetes command-line tool, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs
Kubectl operates from a user’s local machine and communicates with the Kubernetes API server to issue commands and manage the cluster’s desired state. Configuration for Kubectl is typically stored in a user’s local configuration file, allowing for easy context switching between different clusters.
Kubelet on the other hand, serves as the Kubernetes node agent, running on every node within a Kubernetes cluster. Its primary responsibility is to manage containers on the node and ensure they align with the cluster’s desired state.
Kubelet creates and supervises pods, interacts with the container runtime (such as Docker), and reports node status to the control plane components. While Kubelet plays a vital role in maintaining the health of containers and nodes, it operates autonomously within each node and is managed by cluster administrators, making it less directly accessible to end-users.
I hope you learned something from this blog. If you have, don’t forget to follow and click on like 🤍button below to show your support 😄. Subscribe to my blogs so that you won’t miss any future posts.
I Hope you find this article useful. If you have any questions or feedback, feel free to leave a comment below. Thanks for reading and have an amazing day ahead!
Stay connected on Linkedin