Kubernetes/: Introduction
Tags: kubernetes, docker, opensource, devops
Published: 2022-10-28 18:31:55

### 👀 **What is Kubernetes?** 
Kubernetes or K8s is container orchestration system on "steroids". It takes care of automatic deployment of containerized applications across different servers. 
It scale the system up and down automatically and also takes care of the distribution of load across multiple servers automatically. It will also take care of monitor and perform health checks of containers, replacing the failed ones.
It also provide many more features that you'll be learning throughout the course.

### 📝 **Important Terminology**  
Lets cover some of the important terms and concepts that you'll be listening throughout the course.

#### - **Cluster:**
 A Kubernetes cluster (or cluster) is a grouping of nodes that run containerized applications in an efficient, automated, efficient and scalable manner.
It consists of master nodes(or control plane) and worker nodes. Every cluster has at least one worker node. Worker nodes are the nodes where your containerized application is running. The control plane manages the worker nodes and the Pods in the cluster. The control plane's components make global decisions about the cluster (for example, scheduling), as well as detecting and responding to cluster events (for example, starting up a new pod when a deployment's replicas field is unsatisfied).

#### - **Pod:**
 Pods are the smallest, most basic deployable objects in Kubernetes. A Pod represents a single instance of a running process in your cluster. Pods contain one or more containers, such as Docker containers. When a Pod runs multiple containers, the containers are managed as a single entity and share the Pod's resources.
Pods also contain shared networking and storage resources for their containers.

#### - **Control Plane:**
 Control plane is responsible for making the decisions about the cluster as well as detecting and responding to the events that occur within a cluster. Control plane components can run on any machine in the cluster however for simplicity they are usually on same machine. These components are kube-apiserver, etcd, kube-schedular, kube-controller-manager, cloud-controller-manager.

#### - **Node:**
 A Node is a worker machine in kubernetes and maybe a virtual machine or physical machine, depending on the cluster. Each node is managed by the control plane. A node can hold multiple pods and control plane automatically handles the scheduling pods across the Nodes in the cluster.

### ⚙ **Kubernetes Cluster Components**  
When you deploy Kubernetes, you get a cluster.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0px7wn1hzaqupxgn0bsh.png)
Lets discuss each component in details,
#### **Control Plane components:**
- **kube-apiserver**
 The apiserver is the front-end to the K8s control plane that exposes the Kubernetes API.
 The Kubernetes API server validates and configures data for the api objects which include pods, services, replicationcontrollers, and others. The API Server services REST operations and provides the frontend to the cluster's shared state through which all other components interact.
- **etcd**
 It is a strongly consistent, distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system or cluster of machines.
 More info on etcd [etcd.io docs](https://etcd.io/docs/)

- **kube-scheduler**
 kube-scheduler is the default scheduler for Kubernetes and runs as part of the control plane. kube-scheduler is designed so that, if you want and need to, you can write your own scheduling component and use that instead. 
 The Kubernetes scheduler is a control plane process which assigns Pods to Nodes. The scheduler determines which Nodes are valid placements for each Pod in the scheduling queue according to constraints and available resources. The scheduler then ranks each valid Node and binds the Pod to a suitable Node. A scheduler watches for newly created Pods that have no Node assigned. For every Pod that the scheduler discovers, the scheduler becomes responsible for finding the best Node for that Pod to run on. 

- **kube-controller-manager**
 The Kubernetes controller manager is a program that runs continuously as a background process and wakes up to handle periodic service requests, which often come from remote processes. It embeds the core control loops shipped with Kubernetes. In applications of robotics and automation, a control loop is a non-terminating loop that regulates the state of the system. In Kubernetes, a controller is a control loop that watches the shared state of the cluster through the apiserver and makes changes attempting to move the current state towards the desired state.
- **cloud-controller-manager**
 Cloud infrastructure technologies let you run Kubernetes on public, private, and hybrid clouds. Kubernetes believes in automated, API-driven infrastructure without tight coupling between components.
 The cloud-controller-manager is a Kubernetes control plane component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.

#### **Node components:**
Every node in the cluster have dedicated node components running on them.
- **kubelet**
 An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod. It can register the node with the apiserver using one of: the hostname; a flag to override the hostname; or specific logic for a cloud provider. 
 The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn't manage containers which were not created by Kubernetes.
- **kube-proxy**
 kube-proxy maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster. This reflects services as defined in the Kubernetes API on each node and can do simple TCP, UDP, and SCTP stream forwarding or round robin TCP, UDP, and SCTP forwarding across a set of backends.
- **container runtime**
  The container runtime, also known as container engine, is the software that is responsible for running containers. You need to install a container runtime into each node in the cluster so that Pods can run there. Container runtime is responsible for loading container images from a repository, monitoring local system resources, isolating system resources for use of a container, and managing container lifecycle. 

#### **Upcoming Articles** ✍🏻
    Kubernetes/: Onboarding 
    Kubernetes/: Scaling 
    Kubernetes/: Dockerizing 

##### Lets connect
[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sbws0adjeg22fnzyco1i.png)](https://github.com/nishchay7pixels) 
[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u5mq8wbg15afvlv4qkph.png)](https://in.linkedin.com/in/nishchay-verma) 
[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xhvymv4wd9u3507cibr.png)](https://mobile.twitter.com/nishchyaverma)

_[Icons created by riajulislam](https://www.flaticon.com/free-icons/github)_