Kubernetes Day 3 Practicals


  • Architecture
  • Kubernetes Installation
  • Pods

Kubernetes Architecture

k8s Architecture

K8s consists of master and worker nodes, master node manages the worker nodes and the Pods in the cluster.
Master node (control plane) make global decisions about the cluster (for example, scheduling), as well as detecting and responding to cluster events, while worker nodes host the Pods that are the components of the application workload.

Kubernetes cluster components

When you deploy Kubernetes, you get a cluster.
A Kubernetes cluster consists of components that represent the control plane and set of worker machines, called nodes, that run containerized applications.
Every cluster has at least one worker node.

Here’s the diagram of a Kubernetes cluster with all the components tied together.

K8S cluster components
  • API Server

API Server is the Principle component of Kubernetes. API-server is the only component which communicate with every other component.

  • Scheduler
  • etcd

Api-Server is the only component that can reach etcd

etcd is a key value Database.

  • Control Manager

Job of Control Manager is to maintain desired state.

  • kubelet

Kubelet like is the Captan of the Node. It takes the help of Docker to run container/s on the Node/s.

  • Kubernetes Proxy on Node takes care of Networking between pods on Nodes.

Control plane

The control plane manages the worker nodes and the Pods in the cluster. In production environments, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, providing fault-tolerance and high availability.

Worker Node(s)

The worker node(s) host the Pods that are the components of the application workload.

Container runtime

The container runtime is the software that is responsible for running containers. Kubernetes supports several container runtimes: Docker, containerd, CRI-O, and any implementation of the Kubernetes CRI (Container Runtime Interface).

Kubernetes architecture in cloud

k8s architecture in cloud

Kubernetes Installation

On Ubuntu 18.04 LTS

1. Install K8s components on all machines (master & All nodes)

2. Initialize and config the master node

3. Join the worker nodes with cluster

Install a specific version

Kubernetes High Availability (HA) setup

Control plane setup that runs across multiple VMs. https://kubernetes.io/docs/setup/production -environment/tools/kubeadm/high -availability/


Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.
A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.

  • Pod is application image.
  • Pod is just a layer on top of the container.
  • Pods don’t change their IP even though container is restarted where as in Docker container changes its IP after reboot.
  • Pods can not have same type of Multiple images. 

Who creates pod ?

API Server talks to kubelet –> Docker —> Docker pulls image and creates Pod

  • There is no stop, start for Pod, there is only Create & Delete options for POD
  • Imperative command means one-liner.

Using Pods

  • Pods that run a single container.
    The “one-container-per-Pod” model is the most common Kubernetes use case
  • Pods that run multiple containers that need to work together.

Working with Pods

Pods are not directly created, instead they are managed by workload resources, 

○ Deployment
○  StatefulSet
○  DaemonSet

POD Commands

Get Pod details

Describe / inspect a POD
Man pages or Help on objects/object specifications

# Kubectl explain pod
# Kubectl explain pod.metadata

Pod logs

# Kubectl logs <podname>

Connect to a POD

# Kubectl exec -it <podname> –bash

Update or edit the Pod

# Kubectl apply -f pod.yml
# Kubectl edit pod <podname>
It opens the manifest file in editor, modify the file and save.

What is YAML ?

Y : Yet

A : Another

ML : Markup Language

To find details about any kubernetes concept or object run below :

# kubectl explain pod

# Kubectl explain Pods.metadata

To edit existing Pod

Just edit yaml file and Apply

POC / Scenarios

  1. Practice to create below pod :

After creating above yaml file, run below command to execute :

# kubectl create -f filename.yaml

# kubectl run podhttpd –image nginx –dry-run=client -o name.yaml 


Below are few scenarios to try from Akshay

  1. Change image in existing pod
  2. Scaling pod
  3. Deploy apache httpd pod using latest image and container name httpd-latest

MFH DevOps Consultation Services

Add Few lines about the company here


MFH Devops Consulation
#4-72-1/1. 1st Floor, Beach Road Lawson’s Bay Colony, Near Shanti Ashram, Opp. Bharat Petroleum, Visakhapatnam, Andhra Pradesh – 530017