Kubernetes(K8s) Components (Part 1)
Kubernetes is an open source system for automating deployment, scaling, and management of containerized applications. K8s as an abbreviation results from counting the eight letters between the “K” and the “s”.
Kubernetes is hosted by the Cloud Native Computing Foundation (CNCF).
Why Kubernetes?
Kubernetes is by far the most popular platform to manage and orchestrate solutions based on containers (Containers are a way to package and deliver the application code).
Kubernetes provides you with a framework to run distributed systems flexibly. It takes care of scaling and failover for your application, provides deployment patterns, and more.
Here are what might be good reasons to go with a containerized application and K8s as a platform:
- Service discovery and load balancing(quick scaling up/down depends on the workloads) Kubernetes can expose a container using the DNS name or using their own IP address. If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.
- Auto-scaling. Automatically scale containerized applications and their resources up or down based on usage.
- Storage Ability to mount and add storage dynamically.
- Blue/Green Deployments Declare the desired state, and K8s works in the background to maintain that state and recover from any failures.
- Resource Management You can tell Kubernetes how much CPU and memory (RAM) each container needs. Kubernetes can fit containers onto your nodes to make the best use of your resources.
- Self-healing Kubernetes restarts containers that fail, replaces containers, kills containers that don’t respond to your user-defined health check.
- Secret and configuration management Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys.
Kubernetes Components
The Kubernetes architecture is designed to run containerized applications. A Kubernetes cluster consists of at least one control plane and at least one worker node (typically a physical or virtual server). The control plane has two main responsibilities. It exposes the Kubernetes API through the API server and manages the nodes that make up the cluster. The control plane makes decisions about cluster management and detects and responds to cluster events.
The smallest unit of execution for an application running in Kubernetes is the Kubernetes Pod, which consists of one or more containers. Kubernetes Pods run on worker nodes.
Control Plane Components
As the name implies, it controls how Kubernetes interacts with your applications.
The control plane’s components make global decisions about the cluster (for example, scheduling), as well as detecting and responding to cluster events.
Operations are issued to it either through HTTP calls or connecting to the machine and running command-line scripts.
kube-apiserver
As its name suggests, the kube-apiserver exposes the Kubernetes API. The API server is the front end for the Kubernetes control plane.
All operations against pods, services, and so forth, are executed programmatically by communicating with the endpoints provided by it.
etcd
A key-value store where all data relating to the Kubernetes cluster is stored.
kube-scheduler
The scheduler is responsible for assigning work to the various nodes. It keeps watch over for new Kubernetes Pods with no assigned nodes and assigns them to a node for execution based on resources, policies, and ‘affinity’ specifications.
kube-controller-manager
All controller functions of the control plane are compiled into a single binary. Itoversees various controllers which respond to events (e.g., if a node goes down or watches for Job objects that represent one-off tasks, then creates Pods to run those tasks to completion etc).
Node Components
kubelet
An agent that makes sure that the necessary containers are running in a Kubernetes Pod.
It tracks the state of a pod to ensure that all the containers are running. It provides a heartbeat message every few seconds to the control plane. If a replication controller does not receive that message, the node is marked as unhealthy.
Kube-proxy
A network proxy that runs on each node in a cluster to maintain network rules and allow communication.
It 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
The software responsible for running containers. Kubernetes supports any runtime that adheres to the Kubernetes CRI (Container Runtime Interface).