Kubernetes Architecture

Kubernetes Architecture

Control Plane

kube-apiserver

The Kubernetes API is made available via the API server, which is a part of the Kubernetes control plane. The Kubernetes control plane's front end is the API server.

Kube-apiserver is the primary example of a Kubernetes API server. The kube-apiserver is made to grow horizontally, or by adding more instances. Kube-apiserver may run in several instances, with traffic distribution across them.

etcd

All cluster data is stored in a reliable and highly accessible key-value store that is utilized by Kubernetes.

If the etcd backing store is used by your Kubernetes cluster, be sure to have a data backup strategy in place.

The official documentation contains in-depth information on etcd.

kube-scheduler

Component of the control plane that searches for freshly formed Pods that have not yet been given a node and chooses one for them to run on.

Individual and group resource needs, hardware/software/policy restrictions, affinity and anti-affinity standards, data locality, inter-workload interference, and deadlines are all taken into consideration while making scheduling decisions.

kube-controller-manager

component of the control plane that controls controller operations.

Although technically each controller should operate as a distinct process, they are all compiled into a single binary and executed in a single process to decrease complexity.

Some types of these controllers 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.

Node Components

Every node has components running on it that keep running pods up and running and provide the Kubernetes runtime environment.

kubelet

an agent that is installed on each cluster node. It confirms that containers are operating within a Pod.

The kubelet checks that the containers defined in a collection of PodSpecs that are delivered via various methods are active and in good condition. Containers that weren't built by Kubernetes are not managed by the kubelet.

kube-proxy

Every node in your cluster runs kube-proxy, a network proxy that executes a portion of the Kubernetes Service concept.

On nodes, kube-proxy keeps track of network policies. These network rules permit network connectivity to your Pods from sessions both inside and outside of your cluster.

If an operating system packet filtering layer exists and is available, kube-proxy uses it. If not, kube-proxy automatically forwards the traffic.

Container runtime

The program in charge of executing containers is known as the container runtime.

Container runtimes like containers, CRI-O, and any other CRI (Container Runtime Interface) implementation are supported by Kubernetes.

Kubeadm

You may build a Kubernetes cluster that complies with best practices using kubeadm. In actuality, you may configure a cluster using kubeadm so that it will pass the Kubernetes Conformance tests. Additionally, kubeadm allows cluster upgrades and other cluster lifecycle activities like bootstrapping tokens.

To initialize the control-plane node run:

kubeadm init <args>

Minikube

Single node architecture.

To install the latest minikube stable release on x86-64 Linux using binary download:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Start your cluster

From a terminal with administrator access (but not logged in as root), run:

minikube start

Pause Kubernetes without impacting deployed applications:

minikube pause

Unpause a paused instance:

minikube unpause

Halt the cluster:

minikube stop

Change the default memory limit (requires a restart):

minikube config set memory 9001

Browse the catalog of easily installed Kubernetes services:

minikube addons list

Create a second cluster running an older Kubernetes release:

minikube start -p aged --kubernetes-version=v1.16.1

Delete all of the minikube clusters:

minikube delete --all

Important command

  • kubectl get nodes

  • kubectl get pods -n kubesystem to check all components of the node.

  • kubectl get pods -n kubesystem -o wide.