Kubernetes, how it works

Kubernetes is a container orchestrator tool.

It solves the problem of manually launching, monitoring and maintaining container applications.

A Kubernetes cluster is a set of Nodes and a control plane (aka master)

Master controls all the nodes, it does so by using following components:

a) API server:

All incoming and outgoing communication with the cluster is done through API server.

It communicates using JSON files and communication can be established through a set of REST API

b) Cluster Store:

It maintains all information about cluster in etcd form.

It maintains record of health and actions of all nodes.

c) Controller Manager:

It is a script that is always running to monitor all activities in a cluster.

d) Kube-scheduler:

It watches API server for all incoming tasks and schedule nodes based on affinity, constraint and resource requirement.

Each node contains

a) Kubelet:

It is the main Kubernetes agent, as long as it is running, the node can be said to be a part of the cluster.

It registers itself with the master.

It instantiates a pod.

— Pod is a logical entity to group containers.

b) Container Engine:

It pulls images, start & stops containers. It runs the containers

c) Kube proxy

It assigns IP addresses to pods, this allows access to load balancer.

Typical execution of launching a container:

  1. Request goes to API server

2. API server checks availability in etcd as sent by control manager

3. API server asks scheduler to communicate with node.

4. Scheduler asks kubelet to instantiate pod

5. Contaainer Engine launches containers and Kube proxy updates IP table

6. IP can be used to access services