Kubernetes
Simplified Architecture
Kubernetes is a tool that can be used to automatically deploy, scale and maintain software systems which needs to be dynamic in handling user requirements and flexible in adapting to changing technologies and development practices. It was developed by google, along with an ecosystem of supporting tools and deployment platforms kubernetes enables smooth delivery and maintainance of complex software solutions.
The very first thing we need to know about K8s is the machine in which it is installed and is running, this can be a physical machine or a virtual one, running on premise, or cloud. This machine is called Node and we have two kind of Nodes namely the master node and worker node (also called minion). Collection of these nodes form a cluster. Main difference between these nodes are in the components of kubernetes that gets installed in them.
Master node manages the scheduling and running of containers in worker nodes. The components that we have in master node are called control plane components. So when some one is talking about control plane they are mostly referring to master node. Master node stores information about different nodes and the containers inside those nodes.
Master node components:
The catalog of containers and their state is stored in the master node in a highly available key value store called etcd. A scheduler in the master node looks for right node for a container by checking different requirements of the container and the resources available in the node. Master node also have controller managers like node controller responsible for onboarding of new nodes and replication controllers responsible for managing the number of running containers. Communication between these components are orchestrated using kube api server, it monitors the state of nodes and containers by exposing kubernetes API.
Worker node components:
Since we are dealing with containers we need a software to run them which is container run time the most common one being docker. Kubelet is an agent that runs on worker nodes and manages the containers and communicate with master node about their status and availability. Communication between worker nodes are enabled by a component called kube proxy.
Set Up
In order to set up a production ready kubernetes cluster we need atleast two physical or virtual machines, we can use kube admin tool to set up the cluster. Once we have the machines set, we need to:
- install a container runtime like docker or containerd.
- install kube admin tool in all the machines.
- on the machine which we will use as master node initialise the master server.
- set up the pod network on all the machines
- worker nodes can join the master node.
Once the cluster is ready we can deploy our applications in kubernetes.
Refer this documentation for more information.
For local development we can use single node minikube cluster. Which easier to install, along with kubectl utility it is a good place to start.