Kubernetes for Newbies

Raghavendra Hiremath
4 min readFeb 26, 2021

Progress is never linear, never give up.

Kubernetes is developed by Google and it has been open sourced under Apache, and in simple terms it manages containers(Includes Third-Party tool). It is an orchestration tool.

Cloud vendors such as AWS, Azure and GCP are including Kubernetes as a service on their console, they are adding value by implementing advance features to meet business objectives.

AWS calls it as EKS ( Elastic Container Service for Kubernetes).
GCP calls it as GKE (Google Kubernetes Engine).
Azure calls it as AKE (Azure Kubernetes Engine).
OR we call it as K8’s (Kubernetes).

Why Kubernetes? Why should I care about it?

Are you running single services/microservices on single/multiple VMs? If yes, then you would understand the pain of taking care of the underlying infrastructure.

Kubernetes solves this problem through it’s components:

  1. Pod: Smallest unit of K8s is a Pods, it is an abstraction layer on containers.
  2. Master Node and Worker/Slave Node
  3. Worker Node at any given point of time has three services running ( Kubelet, KubeProxy and Container runtime service)
  4. Master Node will have API Server, Control Manager , etcd and Scheduler.

Let me go through 30,000 feet on these components.

Basic diagram

API Server: It can be accessed by UI, Kubectl and SDK
Scheduler: Schedules PODS, Services, Ingress, Volume, etc. via Kubelet
Controller Manager: Manages the keep track of worker state.
ETCD: It is a brain of the cluster, he hold the key value records of the activities.

POD: It is an abstraction layer on container.
Kubelet: Executes the API commands
Container Runtime: It manages container within the POD and node.
KubeProxy: Allows your POD to expose to Internet.

In Practical, it is quite mess to setup worker node and slave node; we end up consuming resources on your laptop. We will download and install below components on your laptop(Mac, Linux or Windows).

Minikube : Follow the link to download and install https://minikube.sigs.k8s.io/docs/start/

Kubectl: Follow the link to download and install.
https://kubernetes.io/docs/tasks/tools/install-kubectl/

Why Minikube?

Minikube is a single node which contains both worker node and master node process running on it. It runs on a hypervisor.

To start MiniKube from your termina/cmd, type the below command

To find the kubectl version, type the below command

kubectl is a useful command line utility which interacts with API Server. You can check the installed node on VMs.

To list the number of pods in a node

In Kubernetes, we spin up POD in two ways:
1. Deployment Config.
2. Manually write the Deployment configuration file.

Let us now download httpd image and run it as container inside POD using Deployment config

Deployment is created and we will see if httpd has spin up in pod

httpd-depl-7ddbf447b4-nfbzh is an Name of the pod.

To access the container, type the below command

To check the logs of the POD creation time, use the below command

You can list the default replica set of the given deployment file/config using the below command

Now, if we need two replica of HTTPD for fault tolerant then we will edit the deployment configuration file.

I have changed the replica set to 3 to take the changes on the fly. Now when I list the POD, we see three HTTPD instance spun up.

Next Episode, I will update Kubernetes Networking, Persistent Volume and how to write deployment config file. I will update the GIT for you guys to follow up.

Thank you everyone! Have a nice day and please let me know if any improvements are required. Please like this blog.

--

--

Raghavendra Hiremath

WE BELIEVE IN FREE AND OPEN SOURCE. My mission is to constantly learn and share the knowledge I gain so that you can use it to empower you.