Kubernetes Components
Last updated
Last updated
Kubernetes is a powerful open-source platform designed to automate deploying, scaling, and operating application containers. It groups containers that make up an application into logical units for easy management and discovery. Here’s an overview of the key components of Kubernetes as well as an architecture diagram:
API Server (kube-apiserver):
The API server is the entry point for all REST commands used to control the cluster. It processes the API calls, validates them, and then executes them by interacting with the other components of the cluster.
Controller Manager (kube-controller-manager):
This component runs various controllers, such as the replication controller, which ensures that the correct number of pods are running, or the endpoint controller, which maintains the endpoint objects (which help with service discovery). Essentially, controllers monitor the state of the cluster and make changes to ensure the desired state matches the current state.
Scheduler (kube-scheduler):
The scheduler is responsible for placing the right pod on the right node based on resource requirements, policies, and constraints. It continuously watches for newly created pods that have not been assigned to a node and then selects a suitable node for them.
etcd:
etcd is a distributed key-value store that Kubernetes uses to store all its configuration data, state data, and metadata. It’s a critical component as it serves as the central source of truth for the entire cluster.
Kubelet:
The kubelet is the agent that runs on each worker node. It ensures that containers are running in a pod. The kubelet watches the API server for pods that have been assigned to its node and ensures that the containers described in those pods are running and healthy.
Kube-proxy:
Kube-proxy is a network proxy that runs on each node in the cluster, implementing part of the Kubernetes Service concept. It maintains network rules on nodes, allowing network communication to your pods from inside or outside of the cluster.
Container Runtime:
The container runtime is the software responsible for running containers. Kubernetes supports several container runtimes, such as Docker, containerd, and CRI-O. The runtime pulls container images from a registry, starts and stops containers, and connects them to the network.
Pod:
A pod is the smallest deployable unit in Kubernetes. It can contain one or more containers, which are scheduled together on the same node. Containers in a pod share the same network namespace, IP address, and storage volumes, allowing them to communicate with each other easily.
Service:
A service in Kubernetes is an abstraction that defines a logical set of pods and a policy by which to access them. Services enable communication between different sets of pods, load balance traffic, and provide stable endpoints for interacting with the pods.
ConfigMaps:
ConfigMaps allow you to decouple environment-specific configuration from your container images, so that your applications are easily portable.
Secrets:
Secrets are similar to ConfigMaps but are intended to hold sensitive information, such as passwords, OAuth tokens, and SSH keys, which should be kept out of your application code.
Namespace:
Namespaces provide a mechanism for isolating groups of resources within a single cluster. They are used to divide cluster resources between multiple users or teams, typically in larger clusters.
Ingress Controller:
An Ingress is an API object that manages external access to services in a cluster, typically HTTP. Ingress controllers, which implement the Ingress resource, help manage and route the external traffic to the appropriate services in the cluster.
Volumes:
Kubernetes volumes provide storage to containers in a pod. Unlike container storage, which is ephemeral, Kubernetes volumes are persistent storage that can be reused even if the pod is rescheduled.
DaemonSet:
DaemonSets ensure that all (or some) nodes run a copy of a pod. Typically used for background tasks like log collection, monitoring, etc., that need to run on every node.
StatefulSet:
StatefulSets are used to manage stateful applications. Unlike a Deployment, which is used for stateless applications, a StatefulSet maintains a sticky identity for each of their pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.
Deployment:
A Deployment is a resource object in Kubernetes that provides declarative updates to applications. It helps manage the deployment of replica sets, which in turn manage the pods.
ReplicaSet:
A ReplicaSet is a higher-level concept that manages the number of replicas of a pod that should be running at any given time.
Job:
A Job is a Kubernetes resource that is designed to run a task until it completes successfully. Once a job completes, no further pods are started.
CronJob:
A CronJob creates Jobs on a time-based schedule, much like cron jobs in Unix systems.