Getting Started With Kubernetes
Tags: kubernetes, docker, devops, beginners
Published: 2021-03-05 14:09:10

Kubernetes has now become the de facto standard for deploying containerized applications at scale in private, public, and hybrid cloud environments.

###okay, but wait what is Kubernetes?
Kubernetes is a container orchestration system that was open-sourced by Google in 2014. It is a portable, extensible platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available. 

###Now, what does container actually mean?
In simple terms, a container is a place that holds all the required ingredients to run the respective application. In the end, it can be shipped to run in any environment.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8hxj2jn6iw6k97ckv3x.png)The largest public cloud platforms AWS, Google Cloud, Azure, IBM Cloud, and Oracle Cloud now provide managed services for Kubernetes.

###Why use Kubernetes?
In layman's terms, Kubernetes acts like a manager who is responsible for taking care of all the workers(containers).

Now let's see it in technical terms, When we run our production environments using a microservice pattern with many containers, we need to take care of many things. Such as health check, version control, scaling, and rollback mechanism. Kubernetes provides a container-orchestration engine that is used to automate deploying, scaling, and managing containerized applications on a group of servers.

##Kubernetes Architecture
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7uzebevxhaq8qmeqln7b.png)As you can see in the above diagram, there is a lot of gibberish terms that you don’t understand. Let's understand it one by one.

Kubernetes follows the master-slave architecture. Where master is master node and slaves are worker nodes.
 
###*Kubernetes Architecture* consists of 
1) Master Node - It manages the other worker nodes e.g node1 and node2

2) Worker Nodes - Generally, Worker nodes are virtual machines / physical servers running within a data center. It makes available the underlying network and storage for the application to use.

3) Kubernetes cluster - After deployment of Kubernetes, you get a cluster. It is a set of node machines called worker nodes for running containerized applications. where every cluster consists of at least one worker node. If you’re running Kubernetes, you’re running a cluster.

##Kubernetes Components
###Master Node
Master Node is responsible for making decisions about what tasks/operations have to be performed. It monitors everything if something unusual is found then it takes necessary actions respectively to rectify it.

###Components of the Master Node
####kube-apiserver:

- The API server validates and configures data for the API objects which include pods, services, replication controllers, and others. 

- The layer exposes the API and interfaces to define, deploy, and manage the lifecycle of containers.

- The main implementation of a Kubernetes API server is [kube-apiserver](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/).

####etcd:
Kubernetes makes use of “Etcd” to store configuration data of the cluster and to represent the overall state of the cluster anytime. It is a Consistent and highly-available key-value store and the only source on which several entities are dependent to configure the state.

####kube-scheduler: 
It selects the node for newly created pods. Where Control plane component keeps watching for newly created Pods with no assigned node.

####kube-controller-manager: 
The component on the master who runs the controllers includes 4 controllers behind the scenes.
1-Node Controller
2-Replication Controller
3-Endpoint Controller
4-Service Accountant Token Controller
It runs the controller processes in the background to regulate the shared state of the cluster and perform a routine task. When there is any change in the service, the controller spots the change and ensures that nodes are up, running, and healthy.

###Worker Nodes
Worker Nodes are slaves who perform the requested, assigned tasks. And they are controlled by Master Node. In simple terms, it is VM or physical server where containers are deployed. This is also known as a Minion node, and it contains the information to manage networking between containers such as Docker.

###Components of the Worker Node
####Kubelet:
An agent that runs on each node in the cluster and monitors that containers in a Pod are running and healthy. If not, a replication controller observes this change and launches Pods on another healthy Pod.

####Containers:
The container runtime environment is responsible for managing containers, image pulling, stopping the containers, starting the containers, destroying the containers, and more. Which is placed inside the pod and needs an external IP address to view the outside process. Kubernetes supports several container runtimes: Docker, containerd, CRI-O, etc.
[More about Kubernetes Container Runtime Interface](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-node/container-runtime-interface.md).

####Kube-Proxy:
Kube-proxy is a network proxy and a load balancer that runs on each node in your cluster. Kube-proxy maintains network rules on nodes which allows network communication to your pods where the services are exposed to the outside world. 

####Pods:
The way we use several virtual machines in our system. Similarly, Kubernetes Pod acts as our system which runs several containers within it. Here we can run dependent containers as well where the pod acts as a wrapper. Pods abstract the network and storage away from the underlying containers. With the help of pods, we can maintain our containers. This is a place where your app is running.

Okay Okay, I know a whole lot of theory is covered till now. But you made it through, Congratulations🎉! 

In the upcoming blog, we will get our hands dirty and start with Kubernetes commands that will help you improvise your learnings. Till then follow up the [Installation Guide](https://kubernetes.io/docs/tasks/tools/) and explore the tools available. Use/Install the tools supported by the Kubernetes community.

####**Reach me out on the following links:**
**[LINKEDIN😀](https://www.linkedin.com/in/vikas-tiwari-1b051818b/)** **[YOUTUBE🚀](https://www.youtube.com/channel/UCI_xIqMJa1Oirfjx5-ykylA)**