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 โ˜น๏ธ

What is kubernetes | Kubernetes inclined scorpio
What is kubernetes

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! ๐Ÿคทโ€โ™‚๏ธ

What is kubernetes | Kubernetes inclined scorpio

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 ๐Ÿ˜ƒ

What is kubernetes | Kubernetes inclined scorpio

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 ๐Ÿ˜‰

What is kubernetes | Kubernetes inclined scorpio

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 ๐ŸŽ‰๐Ÿฅณ

What is kubernetes | Kubernetes inclined scorpio

But, can you also explain or Step by Step Guide for creating those 2 VM’s โ˜บ๏ธ ?

IntroducingMinikube

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 ๐ŸŽ‰๐Ÿฅณ

What is kubernetes | Kubernetes inclined scorpio
Read Part 2 to know if yaml is only thing you need ๐Ÿ‘

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

Inclined Scorpio

Admin

We are following a trend we are building. Hop in if you have the power of words ๐Ÿ”ฅ

Top Trending Blogs ๐Ÿคฏ๐Ÿ‘‡

We are Hiring !

Inclined Scorpio is looking for passionate writers ๐Ÿ–‹๏ธ To join us, reach out to us by clicking the button and rest we will take care of.๐Ÿ˜‰

Let’s build amazing content on web !
Inclined Scorpio ๐Ÿ”ฅ

Please leave your comments below ๐Ÿ˜ƒโœŒ๏ธ


Inclined Scorpio

Inclined Scorpio

Inclined Scorpio - by Ashutosh Tiwari, is a platform to bring deserved Writers in a single platform. You can contact them in case you are looking for writers or want your own website setup or management.

6 Comments

Avatar

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

    Inclined Scorpio · April 11, 2021 at 2:14 am

    Thanks Shivam, be tuned for upcoming book Reviews ๐Ÿ˜‰โœŒ๏ธ

    Inclined Scorpio

Avatar

Kanika Tiwari · April 11, 2021 at 2:12 am

Oho k8 ke Guru ji. Haha, good work, keep it up.

Avatar

Garry · April 11, 2021 at 3:10 am

Amazing as most of your blogs buddy

Avatar

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.

Leave a Reply

Your email address will not be published. Required fields are marked *