DevOps Classroomnotes 12/Feb/2022

Kubernetes Master and Node Components

  • Refer Here for the detailed article for Master and Node Components
  • Master Node Components
  • API Server
  • etcd
  • Scheduler
  • Controller Manager
  • Cloud Controller Manager
  • Node Components
  • kubelet
  • container runtime
  • kube-proxy
  • Cluster DNS

Kubernetes Cluster Setup using kubeadm

  • We would install Single Master K8S Cluster
  • Refer Here for the installation instructions
  • Install Container runtime on all the nodes
  • Refer Here
  • Change the cgroup to systemd.
sudo vi /etc/docker/daemon.json
# add the following
"exec-opts": ["native.cgroupdriver=systemd"]
# execute the following statements
sudo systemctl daemon-reload
sudo systemctl restart docker

  • Now install kubeadm, kubelet and kubectl on all the nodes. We have created ubuntu distribution so the steps will be
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
  • Login into the Master Node
  • login in as root user sudo -i
  • Now lets start by creating a kubernetes cluster using kubeadm
kubeadm init --pod-network-cidr=

  • Kubeadm will give instructions as shown below
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join --token jw5g9f.kpd346usnctapvuj \
        --discovery-token-ca-cert-hash sha256:dd1bec94933fecaaf7317dba785a965b4b16f5b67a9ca11476887af713ad7936
  • Now lets install flannel pod network
kubectl apply -f

* Now lets join the nodes to the kubernetes cluster. Login into node, become root user and execute the following command (command returned from kubeadm init)

kubeadm join --token jw5g9f.kpd346usnctapvuj \
        --discovery-token-ca-cert-hash sha256:dd1bec94933fecaaf7317dba785a965b4b16f5b67a9ca11476887af713ad7936

* Now login into master and execute kubectl get nodes

  • Kubernetes Network is implemented based of specification called as CNI (Container Network Interface) and there are many implementations of it, in the above installation we have chosen flannel which is overlay implementation for communications

Pod in Kubernetes

  • Using Hypervisors like hyper-v, vmware we create virtual machines, using docker we create containers. The Atomic unit of creation for Hypervisor is Virtual Machine and for Docker it is container
  • In K8S the atomic unit of Work is Pod.
  • A Pod is group of one or more containers with shared network and storage resources.
  • Lets try to create a Pod using kubectl.
  • Lets create a pod using imperative kubectl run httpd --image httpd
  • Lets create a pod using declarative approach. Create a yaml file
apiVersion: v1
kind: Pod
  name: httpd
    - name: httpd
      image: httpd:latest
        - containerPort: 80



  • kubectl cheatsheet Refer Here
  • When working with kubectl we have two approaches
  • imperative:
    • To create our workloads we use commands
  • declarative
    • We define our desired file in a yaml file and provide the yaml file to the kubectl

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner