Core Concepts K8s
TECH
9/22/20231 min read
ETCD
Part of control plane
key-value database
Stores all the k8s resources, objects
etcdctl get / --prefix -keys-only
Kube API Server
Part of control plane
The only component that directly talks to ETCD
Whenever we run any get command with kubectl, it goes to the API server for
Authenticate user
Validate user
Retrieve data from ETCD
Update ETCD
Scheduler
Kubelet
Kube Controller manager
Part of control plane
Node controller: Monitor the status of nodes. If not reachable, mark them not reachable.
Replication controller: Make sure the desired number of replicas of a pod is always running
Cloud controller: to provision cloud volumes
Scheduler
Part of control plane
Actively monitor the API server for a new pod and find the right node for the pod using the scheduling framework.
Which pod goes where
Pods are put in a queue
Pods are sorted based on priority in the queue
Nodes are filtered based on pod affinity or tolerations
Nodes are scored based on which one could be the best candidate. For example, the node which has more resources available can get a better score.
Pods go through a pre-bound step if there is any volume to be mounted etc.
Pods are bound to the best-scored node
If there is a new pod created and not assigned a node yet it identifies the right node to schedule the pod on and communicate back to the API server. API server then, in turn, updates the ETCD cluster. The Kube API server then passes the information to Kubelet in the chosen node. Kubelet creates a new pod by instructing container run time to deploy the images. Once done, it communicates back to the Kube API Server. The Kube API server updates the data in ETCD.
Kubelet
Part of the worker plane
Monitor the nodes, and pods and report back to Kube API server about the status
Kube Proxy
Runs on each node
Create IP table rules to forward requests coming to service IP to pod IPs
Within a cluster, Every pod can reach any other pod using this Pod network solution called kube proxy