Kubernetes

Kubernetes is an open-source container management tool that automates container deployment, container scaling and load balancing.

It schedules, runs and manages isolated containers which are running on virtual/physical/cloud machines.

All top cloud providers support Kubernetes.

History

  1. An internal system called Borg, later named Omega deploys and manages thousands of Google applications and services on their cluster.

  2. In 2014, Google introduced Kubernetes and open-source platform written in Golang and later donated it to CNCF (Cloud Native Computing Foundation.)

Online Platform for K8S

  1. Kubernetes Playground.

  2. Play with K8S.

  3. Play with Kubernetes Classroom.

Cloud-based K8S services

  1. GKE (Google Kubernetes Engine)

  2. AKS (Azure Kubernetes Service)

  3. Amazon EKS (Elastic Kubernetes Service)

Kubernetes Installation Tool

  1. Minicube

  2. Kubeadm

Problems with scaling up the container

  1. Containers cannot communicate with each other.

  2. Auto-scaling and load balancing were not possible.

  3. Containers had to be managed carefully.

Features of Kubernetes

  1. Orchestration (clustering, any number of containers running on different n/w)

  2. Auto-Scaling (Vertical and Horizontal)

  3. Auto healing.

  4. Load balancing.

  5. Platform-independent

  6. fault tolerance

  7. Rollback (Going back to the previous version)

  8. Health monitoring of containers.

  9. Batch execution (one-time, sequential, parallel)

Architecture of Kubernetes

a. Kube-api-server- {for all communication}

  1. The API server interacts directly with the user.

  2. The Kube API server is meant to scale automatically as per load.

  3. The Kube API server is the front end of the control panel.

b. etcd

  1. Stores metadata and status of the cluster.

  2. etcd is consistent and highly available.

  3. Stores key-value.

  4. It is fully replicated, secure and fast.

c. kube-scheduler

  1. When users request the creation and management of pods, kube- Scheduler is going to take action on these requests.

  2. Handles pod creation and management.

  3. A scheduler watches for newly created pods that have no node assigned. For every pod that the scheduler discovers, the scheduler becomes responsible for finding the best node for that pod to run on.

  4. Gets the information for hardware configuration from config files and schedules the pods on nodes accordingly.

d. Controller-manager

  1. It makes sure the actual state of the cluster matches the desired state.

  2. Two possible choices for control managers.

    If K8S is on the cloud, then it will be a cloud-control manager.

    If K8S is on non-cloud then it will be the kube-control manager.

Node is going to run three important pieces of s/w processes.

a. Kubelet

  1. The agent running on the node.

  2. Listens to the Kubernetes master.

  3. Uses port 10255.

  4. Send success/fail report to the master.

b. Container engine

  1. Works with kubelet.

  2. Pulling images.

  3. Start/ Stop containers

  4. Exposing containers on the port specified in the manifest.

c. Kube-proxy

  1. Assigns IP to each port.

  2. It is required to assign an IP address to pods

  3. kube proxy Runs on each node, and this makes sure that each pod will get its unique IP address.

POD

  1. The smallest unit in Kubernetes.

  2. POD is the group of one or more containers that are deployed together on the same host.

  3. A cluster is a group of nodes.

  4. A cluster has at least one worker node and a master node.

  5. In Kubernetes, the control unit is the pod, not the container.

  6. Consist of one or more tightly coupled containers.

  7. POD runs on a node that is controlled by the master.

  8. It only knows about pods and does not know about individual containers.

  9. Cannot start a container without the pod.

  10. One pod usually contains one container.