Kubernetes is an open-source generic multi-container management software which offers deployment, scaling, descaling & load balancing. It’s an orchestrator for microservices applications. Kubernetes would make us see the whole data center as a computer. Kubernetes can manage any type of containers which follows OCI standards. ( Docker or Core OS’s rkt or any ). Kubernetes keys features are automated scheduling, self-healing capabilities, automated rollouts and rollbacks, horizontal scaling and load balancing.
Kubernetes Architecture consists of two key components – Master node and Worker nodes (Minions).
K8s Master – Node – Cluster
Master Node – The Kubernetes Control Plane
Master node works like a Manager who manages the team to spin multiple workloads or similar to a football coach who had great control on his team. Master nodes are in-charge and make the global decisions that which nodes to work on the requests. Multi-Master setup is also possible in Kubernetes to eliminate the single point of failure (Multi-Master HA). The master node runs only on Linux but not limited any specific platform. It could be bare metal, VM, OpenStack instance or any cloud instances. Do not run user containers on the master node.
Master Node’s Components:
The master node has the following components.
- kube-apiserver
Kube-apiserver follows scale-out architecture. kube-apiserver is a front end to the control plane of the master node. It provides the external facing interface to communicate with the world via REST API. The Kube-apiserver also makes sure that there is communication established between the Nodes and the master components.
- etcd – The Cluster Store:
etcd is a mission-critical distributed key-value store. It provides a reliable way to store data across the kubernetes cluster and representing the state of the cluster at any given point in time. Kubernetes uses etcd as a source of truth for the cluster. So, you must have a solid backup plan for it.
- kube-controller-manager
Kube-Controller Manager is a controller of controllers. It’s a daemon that embeds controllers and does namespace creation and garbage collection. It owns the responsibility and communicates with the API server to manage the end-points. Kube-controller-manager controls the following controllers.
- Node Controller – Manages the Node (Create, Update & delete)
- Replication controller – Maintains the number of pods as per manifest.
- Service Account & Token controller – Create default accounts and API tokens for new namespaces.
- Endpoints Controller – Take cares of endpoint objects (services, pods)
- kube-scheduler
The kube-scheduler keeps watches apiserver for new pods requirement. It is responsible for distributing the workload to the worker node. It keeps track of all the worker node’s resource utilization. So, It takes the logical decision based on the new pod’s resource requirement and existing worker node’s load. Kube-scheduler also needs to think about the rules that we define (affinity, anti-affinity, constraints).
Nodes a.k.a Minions – The Kubernetes Workers:
Nodes are a lot simpler than the master node. It’s a faceless and characterless system which simply does what master node says. If the node fails or died, we can simply swap it with a new machine to restore the business as usual. In other words, the node provides all the necessary services to run pods on it. Nodes can be a bare-metal, Virtual machine, OpenStack instance or cloud instances.
Nodes consist of the following components:
- Kubelet – Main Kuberbernets agent
This is an agent service which runs on each node and enables the slave to communicate with the master. It registers the node with cluster and watches the master kube–apiserver for the work assignment. It instantiates pods and reports back to the master. It also reports back to master if there is an issue with pods. It exposes endpoint on :10255.
-
- /spec endpoint – Provides the information about the node that runs on.
- /healthz endpoint – Its health check endpoint.
- /pods endpoint – Provides the runnings pods information.
- Container Engine – Container Run-time
Pods package the container into it. To deploy a container, you need container runtime software. In most of the cases, it will be a docker engine. We could also use other container runtime software (ex: rkt). Container engine manages the containers that run on the pod. It will pull the images for deployment and start/stops containers on the pods.
- Kube-proxy
The kube-proxy is a network brain of the node. It ensures that each pod gets unique IP. If you are packing multiple contain trainers in single pods, all the container in a pod shares a single IP. It also load-balances across all pods in a service.
How does it work?
The following diagram shows how pods are created in the worker node. Kubectl is command line utility in which you can pass commands to the Kubernetes cluster to create and manage various Kubernetes component.
Hope this article is informative to you. Share it! Be Sociable!!
In the upcoming article, we will see another important component of Kubernetes – The Pod.
Leave a Reply