Skip to content

Introduction to Kubernetes (K8S)

  • Kubernetes is container orchestration system.
  • It takes care of:
    • Automatic deployment of the containerized application accross different servers.
    • Distribute load accross different multiple servers.
    • Auto-scaling of the deployed application.
    • Monitoring and health check of the containers.
    • Replacement of failed containers.

Supported Container Runtimes

  • Docker
  • CRI-0
  • containerd

Pod

  • Pod is the smallest unit of kubernetes world. Just like in docker, we have smallest unit : container.
  • A pod contains multiple containers, shared volumes, shared IP address.
  • One container per pod is the most common use case.
  • A pod will be in one single server not distributed in multiple server.

Kubernetes Cluster

  • A kubernetes cluster consists of one or more nodes. A node is basically a server.
  • Nodes can be kepts at different data centers, availablity zones but usually they are kept close to each other for better performance.
  • A node contains multiple pods. A pod contains multiple containers.
  • In kubernetes cluster, there are two types of nodes: master node and worker node. The master node manages all the worker nodes.
  • A master node is also called control plane.

Kubernetes Services

  • There are some common services that runs on worker/master nodes. They are kubelet, kube-proxy, container-runtime (Docker / CRI-O/ Containerd).
  • In the master node, there is one service running named "API Server" that communicates with kubelet. This API Server is the main point of communication between multiple nodes.
  • Kube-proxy is responsible for network communication inside the node and between multiple nodes.
  • There are also some other services running in the master node.
    • Scheduler : It manages and distributes loads accross multiple nodes.
    • Kube Control Manager : It controls what happens in each node of the cluster.
    • Cloud Control Manager : For running kubenetes in cloud (AWS, Azure, GCP).
    • etcd : It stores logs of entire kubenetes cluster. Such logs are stored in key-value pais.
    • DNS : For domain name resolution in the kubenetes cluster.

Cluster Management

  • Cluster management is done by kubectl.
  • Kubectl is a command line tool that allows you to connect to remote kubernetes cluster and manage it locally.
  • It establishes HTTPS connection with API Server of master node so that we can manage the cluster.

MiniKube

  • Creates a kubernetes cluster with single node.

  • Start the kubernetes cluster with docker

minikube start --driver=docker
  • Log in the kubernetes cluster
minikube ssh