If you are here then you probably know Docker ๐
You faced many issues while deploying the those containers, ufff !
Don’t worry we know the pain, so does this Guide ๐
Let me address those issues first ๐
1. We manually need to check if container goes down and then restart it๐คฆโโ๏ธ
2. During traffic spike, we need to manually increase no. of containers ๐คฅ
3. There is no way to distribute load to different containers โน๏ธ

But HEY WAIT !
These 3 problems are already addressed by Amazon ECS !!
If you aren’t familiar with Amazon ECS, it does address those issues.
So, Why we need Kuberentes then ? ๐คฏ
To Lose Weight? ๐
While using Amazon ECS, there are ECS specific configurations needed to setup our deployment ๐ง
In case we need to switch to different cloud, then these ECS config won’t work and again we need to change all config according to that cloud provider! ๐คทโโ๏ธ

Don’t get triggered, we know setting those config weren’t buttery ๐
Introducing Kubernetes : Just in case you were using Kubernetes, you could have used it’s config file for deployment in any other cloud provider supporting K8’s (kubernetes) ๐
Obviously if someone wants to stick with Amazon ECS or a single cloud provider then you don’t need Kubernetes ๐คทโโ๏ธ
But what does Kubernetes Do ?
Automatic Deployment
Scaling & Load Balancing
Managing your Services for you
Above 3 points will be discussed completely. Don’t worry!
THINGS TO NOTE โ๏ธ
1. Kubernetes is not a cloud Service Provider ! (It’s a open source project)
2. Kubernetes doesn’t replace Docker rather it works with Docker ๐ฌ
3. It can be used with any cloud provider which has K8’s support. If it doesn’t have you can manually download K8’s and use it there ๐ฅ
4. It’s not a paid service, it’s FREE to everyone. Specific cloud provider can ask for money although for providing some features ๐ฐ
Ah! What’s Kubernetes in one line ?
Think it like Docker-Compose for multiple Machines ๐
Some basic terms in K8’s ๐
โด๏ธ You know Containers ๐ฆ right? In K8’s we have Pod !
โด๏ธ “Pod” is the smallest unit in Kubernetes.
โด๏ธ A pod basically contains a container.
โด๏ธ Although, pod can have more than one container which are related. (Mostly you will see one)
โด๏ธ Pods are kept inside Worker Node ๐ which is basically a computer or a VM Instance.
โด๏ธ Proxy/Config are inside Worker Node to help the pod with communication. These all are the terms you need to know!
โด๏ธ We can have Multiple Worker Node having our pods or containers โ ๏ธ
โด๏ธ Master Node (also a computer or VM Instance) is the one which controls all these Worker Nodes. (We will contact Master Node to control Worker Node).
โด๏ธ Master Node can act as Worker Node if we want. (Not a good time to discuss this)
โด๏ธ This Master Node + Worker Nodes => Cluster
Let’s assume you got it ๐

Ok, So to use Kubernetes What We need to do ? ๐ค
๐ถ We need to create the cluster and the nodes (Worker + Master).
๐ถ Setup API Service, Kubelet(software) and other K8’s software on nodes.
๐ถ Other resources like Load Balancers which might be needed.
If we will do all that then what will kubernetes do ? ๐
Kubernetes will :
๐ข Create Pods and manage them.
๐ข Monitor Pods and recreate, scale them.
๐ข use your given resources to apply your config file.
UNDERSTANDING WORKER NODE
โ๏ธ Worker Node contains Pods
โ๏ธ Pods can have single container or multiple containers (closely related).
โ๏ธ A Single Worker Node can have multiple pods.
We already saw these ๐ด WHAT ELSE IS THERE ?
โ ๏ธ Docker– Worker node have pods < inside which have container < now to run this container Docker is required, hence it must exist in Worker Node.
โ ๏ธ Kubelet – handles communication btw Master and Worker Node. Master gives command to Worker Node, so this is the place which listens to command from Master node.
โ ๏ธ Kube-Proxy – Helps to create network for pods. I mean obviously pod needs to communicate with other pods or communication to outside world (browser), kube-proxy will do the networking thing for us.
UNDERSTANDING MASTER NODE
Lets see what all Master Node has ๐๐
โณ๏ธ API Server: Communication with Kubelet – present in Worker Nodes, discussed above.
โณ๏ธ Scheduler – Watches for any command for running new pods, it then selects Worker Nodes to run them. (It chooses that Worker Node which has more resources)
โณ๏ธ Kube-Controller-Manager – Watches and controls Worker Node, it will always keeps a check if correct no. of pods are running on them.
โณ๏ธ Cloud-Controller-Manager – It’s work is similar like Kube-Controller discussed above but this one is specifically for a cloud provider.
Remember!! you will always be contacting Master Node.
Kubernetes Control or kubectl will help you to do that ๐

CORE COMPONENTS In K8’s
When we say Core Components it’s nothing but the things we already discussed above. Let’s have a look ๐
๐ท Cluster: A set of Master Node + Worker Nodes.
๐ท Nodes: Physical / Virtual Machines which will carry the pods. There were two different types of Nodes we saw. Those were:
๐น Master Node : Has a Cluster Control Plane( Basically a process that runs in there which controls the entire nodes ) -> we saw Master Node in detail above, not going in depth again ! ๐ด
๐น Worker Node : Hosts Pods or basically contains the containers (or services).
๐ท Pods : Holds actual running container + it’s resources (volume) -> you must already know about volume if you had hold it till here ๐
๐ท Services : A logical set of Pods with a unique, Pod – and container independent IP.
BUT HEY WAIT ! ๐ณ
So to use Kubernetes => we need Kubernetes Cluster => and for that we atleast need 2 nodes(Machines) ? => I mean 1 for Master Node and 1 or more for Worker Nodes ?
where to get so many machines from ? ๐
If you remember we have mentioned node as machine OR VM(Virtual Machines).
And we know we can run multiple VM on our system, so 1 machine can work as Master Node and 1 as Worker Node. ๐๐ฏ
So, everything boiled down to creating just those 2 VM’s and we are ready to do anything on K8’s ? ๐ฎ
โ๏ธ YES! Wohhoooo ๐๐ฅณ

But, can you also explain or Step by Step Guide for creating those 2 VM’s โบ๏ธ ?
Introducing ” Minikube “
This will do everything to setup the cluster on your system ! ๐ฅณ
Minikube – can be used to setup a cluster in our system (it’s a single node cluster so both Master and Worker Node are in the same system).
BUT What Next ? Cluster is Created but how to send commands to it to create pods/ containers and all ? ๐ค
Kubectl needs to be downloaded => this will help you to send commands to your cluster created ! ๐
โ ๏ธ NOTE: Kubernetes works with “Objects” like => “Pods“, “Deployments“, “Service“, “Volumes“, we are currently talking about just “Pods”, but as we move forward everything will come into picture!
Pods Pods Everywhere !
๐ข Pods have a internal cluster IP address.
๐ข Container inside pod can communicate via “localhost“.
๐ข For PODS TO BE MANAGED – a “controller” is required which will manage these pods => this controller is called “Deployment“.
๐ข Pods are designed to be “non persistent” => k8’s will start, stop & replace them as needed.
โ ๏ธ Generally, we don’t use Pods directly => but rather “Deployment” => It helps to control Pods and scale them !
โ ๏ธ Our work here is limited to providing the end state to get the desired state. Means to create containers and how many containers, we just need to let deployment know about it and rest it takes care !
So, we just have to tell Master Node the state to achieve through a “yaml” file and rest everything is managed on it’s own ? ๐คฉ
YES ! Wohooo ๐๐ฅณ

uff ! Lots of stuff ๐ฅด
Just in case you didn’t skipped any line in this Blog, you already know the things to kickstart the Kubernetes Journey ! ๐คฉ
We mostly need to know about the commands now ! ๐๐
But again a lot to learn, We will be covering remaining in Part 2 !
Be Tuned ๐
Checkout this Kubernetes Book if you want to become a Guru in K8’s ๐

Inclined Scorpio
AdminWe are following a trend we are building. Hop in if you have the power of words ๐ฅ
Top Trending Blogs ๐คฏ๐
Please leave your comments below ๐โ๏ธ
7 Comments
Shivam Bisht · April 11, 2021 at 2:05 am
Content is formatted in a great way. Always loved to read your blogs ashu
Inclined Scorpio · April 11, 2021 at 2:14 am
Thanks Shivam, be tuned for upcoming book Reviews ๐โ๏ธ
Inclined Scorpio
Kanika Tiwari · April 11, 2021 at 2:12 am
Oho k8 ke Guru ji. Haha, good work, keep it up.
Inclined Scorpio · April 11, 2021 at 2:13 am
Keep Reading ๐๐
Inclined Scorpio
Garry · April 11, 2021 at 3:10 am
Amazing as most of your blogs buddy
Mayank Bhardwaj · April 13, 2021 at 3:59 pm
Nice one Ashutosh. Language used and the colors are always nicely used in your blogs. Will be waiting for part || of Kubernetes.
zortilo nrel · September 19, 2021 at 1:27 pm
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you postโฆ