What is Kubernetes?
(As per kubernetes website)
Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation
The container could be anything and does not matter what platform it is coming from.
The kubernetes setup can be either done on premise or can be deployed on public clouds like AWS, GCP etc.
For the purpose of learning you can also make use of minikube which is a all in one solution i.e there is no separation of worker node and master and everything gets deployed on one virtual machine.
The job of kubernetes is to make sure the container is available and in order to do so it makes use of couple of nodes which includes a controller node(master node) and worker nodes.
The worker nodes is where we run our container engine and it is the job of kubernetes to ensure that container is running in these clusters thereby making it available at all times.
The kubernetes does not directly manage the containers, rather it works on pods which is minimal entity in a cluster environment and can be considered as a wrapper around the containers.
In many cases kubernetes even does not manage a pod, in which case it adds another layer called deployments. The deployments are basically the apps that are running over the containers. The deployments have an important feature called replication which ensures that multiple instances of same pods can get running.
Now K8 makes use of APIs to interact with its objects like pods, deployments and other things in a cluster. It does so through etcd which is the database maintained at K8 master node and which contains all cluster information. The API calls are basically rest API calls and are made using a command utility called kubectl which acts as a wrapper around the API’s. We can also directly make use of curl as well as the kubernetes dashboard(GUI) for the same purpose.
Below is a diagrammatic representation of top level architecture of the Kubernetes:
Common Terminologies in kubernetes:
Cluster : A cluster comprises of the complete kubenetes environment where the master node and worker nodes work in conjunction.
Pods : Pods are the smallest and most basic deployable objects in Kubernetes. A Pod represents a single instance of a running process in your cluster. Pods can contain one or more containers. The containers running inside a pod use the resources of a pod.
Container : A container is a ready to use image that runs inside a pod which can be an application in itself or even a micro-service. It can be a docker container or other containers as well.
Deployments : Maintains a set of identical pods, ensuring that they have the correct config and that the right number of them exist. Deployment manages creating Pods by means of ReplicaSets. Deployment will create Pods with spec taken from the template. It is rather unlikely that you will ever need to create Pods directly for a production use-case.
Nodes: A Node is a worker machine in Kubernetes and may be either a virtual or a physical machine, depending on the cluster. Each Node is managed by the kubernetes master.
Etcd : This is the heart of K8 and is like a database which contains details of all the objects in a K8 cluster like pods, containers, deployments, services etc. It stores data in key value pair mapping and is being used by the K8 API’s for their functioning.
Kube-apiserver : It is the front end of the cluster that services rest operations and connects to the etcd database
Kube-scheduler : It schedules pods on specific nodes and does so based on such as CPU or memory, along with the health of the cluster.
Kube-controller-manager : Controllers take care of actually running the cluster, and the Kubernetes controller-manager contains several controller functions in one. One controller consults the scheduler and makes sure the correct number of pods is running. If a pod goes down, another controller notices and responds. A controller connects services to pods, so requests go to the right endpoints. And there are controllers for creating accounts and API access tokens.
Kubelet : Each of the worker nodes contains a kubelet which is responsible for communicating with the master node. The kublet makes sure containers are running in a pod.
Kube-proxy : Each worker node has a kube-proxy application running which is a network proxy for facilitating Kubernetes networking services. The kube-proxy handles network communications inside or outside of your cluster
Container runtime engine: To run the containers, each worker node has a container runtime engine. An example of the same is docker but there are other engines also that are supported by K8.
Kubectl : A command line utility to make use of K8 API’s.
This is just an introductory blog I started to get an overview of kubernetes. I will try to make this a series and create more such blogs with more of hands-on details around K8 orchestration and management.