Kubernetes is an orchestration server that is use for central management and automatic deployment of containers in our infra. I think we should learn more deeper about orchestration means suppose we are running 10 application in containers and our application is highly productive. So, we need high availability and scalability.
2. sswhat is Kubernetes
What is Kubernetes? I hope if you are working as a devops engineer then definitely you have to
listen about Kubernetes. If you don’t list don’t worry. In this tutorial we are going to learn complete
about Kubernetes and its terminology. Why we use Kubernetes in our infra and how Kubernetes is
better than other technology like docker swarm, rancher etc. and what are the advantages of
Kubernetes over docker swarm?
What is Kubernetes?
Kubernetes is an orchestration server that is use for central management and automatic
deployment of containers in our infra. I think we should learn more deeper about orchestration
means suppose we are running 10 application in containers and our application is highly
productive. So, we need high availability and scalability. For one or two container we can achieve
high availably and scalability manually but suppose if we are running thousands of containers
then Kubernetes comes in scenario. .
Why we use Kubernetes?
I think you have understood basic about what is Kubernetes. Now my question is why we use
Kubernetes.
But before moving next in Kubernetes first learn about docker because Kubernetes
help to overcome the disadvantage of docker. So, what are the challenges of docker that we were
facing before Kubernetes. If I will explain in simple language if we are planning for high availability
scalability central management container provisioning on demand. User management, resource
allocation, share storage , container migration, container recreation all these thinks is not possible if
possible then we have to do manually like if we need 10 copies of container we have to make
manually. If any container become stop, we have to start manually for small infra this is ok but for
health infra like mine we are running 700 containers doing this task manually become hectic.
Advantage of Kubernetes:-
I think you have better understood about what is Kubernetes and why we should use it. Now let’s
discus it’s advantages.
1) Centralized managed system → means we can run the command on all docker host from
one server. No need to go on every system inadvisably and run the command. We can
manage from Kubernetes master server.
2) Centralized container provision → Centralized provision means we can create or destroy
containers from Kubernetes master according to requirement.
3) Maintain state → High availability means suppose in our infra we are running 10 container
and one container becomes destroy. Then Kubernetes master automatically create new
container automatically.
4) Scalability → Scalability means we can increase or decrease resources of containers without
having downtime.
5) Self-maintained load distribution across the pod → Kubernetes also have the beauty of
load distribution on required pod(container)
6) Resource allocation based on project → Resource allocation is good factor means we can set
which one pod will use 2 GB RAM or which will use 5GB etc. according to requirement.
7) User level access based on project → Based on name space we can isolate user level access
like who can see our pod or who can delete or pod etc.
3. 8) Resource planning → We can do resource planning according to our infra requirement with
the help of Kubernetes.
Kubernetes Architecture
Before learning new technology, we should learn about that technology architecture first.
Because with the help of architecture we will be easily able to understand the base of that
technology. So, let’s discuss the architecture of Kubernetes how it works?
Kubernetes Master:--Kubernetes master is those machines from where we will manage our
pod at Kubernetes node. At Kubernetes master server mainly four service will run. But
before learning architecture we should aware about a term that is called POD.
POD --: POD is nothing this is simply a container or collection of containers that is running on
Kubernetes node or client machine.
Now discuss Kubernetes services one by one that will help to understand what is Kubernetes
architecture.
1) KUBE API--:
Kube api is the communication channel into Kubernetes means when execute any
command or access any service all these actions first receive by kube api. Means kube
api will validate user authorization that user have the access to execute command or
access the services. Finally, we can say all communication, authorization and role access
is manged by kube api even if Kubernetes master will run any command or even if client
give and output to Kubernetes master all things will be verified by kube api. So, this is
very use full part of Kubernetes.
2) Kube controller → It will communicate with kubelet on client host node using KUBE API
means suppose we want to run any command on client machine or any action that we
want to perform on client then kube controller comes in scenario.
3) Kube etcd → It contains persistence information of Kubernetes in yaml format. Means
suppose you want launch three pod then api check etcd file here our pod count will be
saved suppose we want to launch tree pod then will be tree suppose want launch four
pod the count will be four in etcd file.
4) Kube scheduler:-- To check best client node for new upcoming pod means suppose we
have three client nodes then it will check on which pod we have available ram or cpu
resource according that it will scheduler upcoming or new pod. We can also apply
custom policy. Like my first pod will launch only on node 1 not any other node. Such kind
of policy we can also perform by scheduler.
Kubernetes Node:-- If I will explain in simple language this is the client machine of
Kubernetes master where our container is running, or we can say that this is client machine
where we want to perform action. Finally, client host is called Kubernetes node.
Kubelet → Kubelet is an agent installed on Kubernetes node. Kube controller will give
command to kubelet and kubelet will run command on client node.
4. Kubeproxy :-- It is used to manage the container networking .
For better understanding go through the architectural diagram of Kubernetes that will to
understand what is Kubernetes and how it’s service communicates with each other.
Still I think it will be clear what is Kubernetes. how it works and why we use it in our infra.
But still in our mind there is raising a question that is if docker community is providing their
own orchestration docker swarm then why we use Kubernetes means third party
orchestration tool. Let’s try to compare and take decision on you own behalf.
5. Conclusion:--
In this tutorial we have discussed what is Kubernetes and why we prefer it in our infra. Also,
we have discussed about difference between Kubernetes and docker swarm. We did this
because moving to next in Kubernetes we should aware about basic of Kubernetes. So, I
tried my best to clear the picture of what is Kubernetes. Still anyone has doubt write me in
comment box. I will try my best to resolve them.
Basic Interview question on Kubernetes introduction?
Write answer of below question in comment box or correct if I am telling any answer wrong.
1) What is pod
2) What is difference between docker swarm and Kubernetes?
3) What is Kubernetes workflow?
4) Which once is better between Kubernetes and docker swarm?
5) What is backup of Kubernetes?
6) Interview can ask about terminology of Kubernetes like etcd, controller etc.
7) What are the port number of Kubernetes?
Ans:- This is very important question what Kubernetes port numbers are:-
1) Scheduler → 10251
2) Controller → 10252
3) Kube-API → 6443
4) Etcd → 2379, 2380
2379 → For client communication.
2380 → For server to server communication.
8) What are the resource planning for Kubernetes service like etcd , kube controller.