Kubernetes

Kubernetes

Β·

5 min read

Kubernetes Overview :

Kubernetes (also known as K8s) is an open-source system for automating deployment, scaling, and management of containerized applications. It is a portable, extensible, open source platform for managing containerized workloads and services. Kubernetes services, support, and tools are widely available.

The name Kubernetes originates from Greek, meaning 'helmsman' or 'pilot'. The name reflects the role of Kubernetes in managing containerized applications. Kubernetes provides a way to automate the deployment, scaling, and management of containerized applications. This allows developers to focus on writing code, while Kubernetes takes care of the rest.

Kubernetes is used by a wide range of organizations, including Google, Netflix, and Spotify. It is a popular choice for managing containerized applications because it is scalable, reliable, and easy to use.

The name K8s is a shortened version of Kubernetes. The "8" in K8s stands for the number of letters between the "K" and the "s" in Kubernetes.

Explain the architecture of Kubernetes ?

The architecture of Kubernetes is designed to manage containerized applications across a cluster of machines. It consists of several key components that work together to provide a scalable, flexible, and resilient platform for container orchestration.

The Kubernetes architecture consists of two main components: the control plane and the nodes.

  1. Master Node:
  • The control plane is responsible for managing the cluster. It includes the following components:

    • API server: The API server is the front-end for the Kubernetes control plane. It exposes a RESTful API that can be used to create, manage, and delete Kubernetes resources.

    • Scheduler: The scheduler is responsible for assigning pods to nodes. It takes into account the resources available on each node, as well as the requirements of the pods.

    • Controller manager: The controller manager is responsible for ensuring that the state of the cluster matches the desired state. It does this by watching for changes to Kubernetes resources and taking corrective action if necessary.

    • etcd: A distributed key-value store that stores the cluster's configuration data, including information about nodes, pods, and services. It serves as the cluster's source of truth.

  1. Worker Node :
  • The nodes are the worker machines that run the containerized applications. Each node has the following components:

    • Kubelet: The kubelet is responsible for running pods on the node. It communicates with the API server to get the instructions for running the pods, and it manages the resources on the node to ensure that the pods have what they need to run.

    • Container runtime: The container runtime is responsible for running the containers on the node. It provides the environment for the containers to run, and it manages the resources that the containers use.

    • Kubernetes proxy: The Kubernetes proxy is responsible for routing traffic to the pods on the node. It makes sure that the pods are accessible from outside the cluster.

The Story of Creating the Connection Between the Master Node and Worker Node Using Kubernete's Architecture

Lets Understand through the Commands,

Master Node:

sudo apt update -y

Worker Node:

sudo apt update -y

Master Node :

sudo apt install docker.io -y

Worker Node:

sudo apt install docker.io -y
  • Both Master Node And Worker Nodes are get updated and the Docker is Installed in both the cluster.

Lets Move Towards Next,

The Same Commands Which you need to fire One by One in Master Node As well As in Worker Node :

Sudo Systemctl start docker 
Sudo systemctl enable docker
curl -fsSL https://dl.k8s.io/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
Sudo apt update -y
sudo apt-get install kubeadm=1.20.0-00  kubectl=1.20.0-00 kubelet=1.20.0-00 -y
  • Once you are fired all the Commands in the Master and Worker Node Terminal, by using Kubeadm the kubectl is successfully make the Connection between the master and worker node.

After Following Above Steps,

Master Node :

  • for making the master node to a root node :
sudo su
  • Used for initialize the master node :
kubeadm init
  • You might be facing issue with the commands in root node which is in the master directory

  • facing issue with the kubectl but solve using below command :

  • fire the below commands one by one :

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
  • Next, Create a Token for access the Master Node for that follow the command :
kubeadm token create β€”print-join-command

By using above command you can join your worker node to your master node easily.

Worker Node :

kubeadm reset pre-flight checks
  • copy the genereted token id from master node which we previously created and paste it on the worker node terminal :
kubeadm join 172.31.92.70:6443 --token vpmil6.rxje10l3ph52hrps     --discovery-token-ca-cert-hash sha256:"Your TokenID" --v=5
  • after pasting of token id, you need to add --v = 5 at the end of the command for avoid some errors which might come.

Master Node :

kubectl get nodes
  • here on Master node you can see the nodes which are worker nodes that are successfully connected to the Master Node in the Kubernetes Cluster.

  • The Controller Manager API server , Kubectl, Kubelet , Kubeadm Plays a very important role while connection between the Master Node and Worker Node.

Simply,if

Master says : Hi

Worker says: Hello

Master says: See you... Tata.. i will disconnect you !

Worker says: Ok sir as your wish.. πŸ˜ƒ

Fun Part.... πŸ˜€ πŸ˜€ πŸ˜€ πŸ˜€
But the Connection is established successfully between them.

What are the benefits of using k8s ?

  • Scalability: Kubernetes can be scaled to handle a large number of containerized applications.

  • Reliability: Kubernetes is designed to be highly reliable. It can automatically restart containers that fail, and it can scale up or down the number of containers as needed.

  • Container Orchestration: Kubernetes automates the deployment, scaling, and management of containers, making it easier to manage complex applications and efficiently utilize resources.

  • Ease of use: Kubernetes is relatively easy to use. There are many tools and tutorials available to help developers get started with Kubernetes.

  • DevOps Enablement: Kubernetes promotes a DevOps culture by enabling developers and operations teams to work together seamlessly. The declarative model and automation features help streamline the development and deployment processes.

Thank You for Reading My Blog.. πŸ‘

Connect with me : linkedin.com/in/shivraj-salunkhe-5881141a4

Follow my Blog channel : shivrajofficial.hashnode.dev

Β