Kubernetes can function with master and slave nodes.
Nodes
A node is a Kubernetes worker machine that may be physical or virtual.
Nodes are managed by the control plane.
Every node must have 3 processes installed, being:
- Container runtime (Docker, Rocket, containerd, etc)
- Downloads images and runs the containers.
- Kubelet
- Communicates with the Kubernetes API Server.
- It's a node process that interacts with the container and the node.
- Kubelet is responsible for starting the pod and container using the defined container runtime and also ensure that they are running.
- Reports health and status to the control plane.
- Kube proxy
- It's a network proxy that forwards the requests and also can apply defined rules.
- When a container makes a request to another service the kube proxy is responsible to forward the request to an available service.
Master node (Control Plane)
There can be multiple master nodes, with the api-server being load balanced.
Every master node needs to have 4 processes, being:
-
Api server (kube-apiserver)
- It is a cluster gateway
- Also functions as a gatekeeper for authentication
-
Scheduler
- Assigns pods to nodes according to constraints and available resources on each node in the cluster.
- After the scheduler chooses the most suitable node the given node forwards the execution to it's own kubelet.
-
kube-controller-manager
- Runs controller processes like:
- 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.
- Endpoints controller: Populates the Endpoints object (that is, joins Services & Pods).
- Service Account & Token controllers: Create default accounts and API access tokens for new namespaces.
-
etcd
- It's the "cluster brain"
- Key value store for all cluster data.
- All cluster changes are stored there.
<aside>
❗ The etcd does not store application data, only data relative to the cluster is being stored there.
</aside>
Example Cluster Set-Up
Layers of abstraction
- Deployment manages a ReplicaSet which manages a Pod which is an abstraction of a container.
- Everything below a Deployment is usually managed automatically by Kubernetes.