Intro to Kubernetes
Published: 2023-07-31 01:29:18

## What is Kubernetes?

Kubernetes is an open-source platform through which developers can manage, deploy and maintain groups of containers. Applications can be made up of hundreds of containers, all of which need to be managed. Additionally, these containers may need to be managed across different environments: physical machines, virtual machines, cloud environments, or even hybrid environments. Managing such containers without a container-orchestration technology would be an exceedingly complicated task.

To address this problem, in 2003, developers at Google created the Borg system. The Borg system is the predecessor of Kubernetes. Kubernetes was then created in 2014 as an open-source alternative to the Borg system. Today, Kubernetes is the most widely-used container management tool. 

## How does it work?


![Kubernetes Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kye7crvfwpsvsllbpzdh.png)

The structure of Kubernetes is divided into discrete components, each responsible for different things. Generally, there are Master Nodes, responsible for higher-order management, and Worker Nodes, responsible for running the applications. 

**Master Nodes**


![Control Plane](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/momxo0l9lvn0sika6rm3.jpeg)

Master Nodes contain many important subcomponents that handle the greater management of the cluster. Firstly, there is an **API server**, which functions as an entry point to the cluster and handles requests. Next, there is a **controller manager**, which keeps running tabs on the state of all components in the cluster. If a component fails and needs repair, the controller manager will detect the failure and handle the repair.

Additionally, the Master Node contains the **scheduler**. The scheduler takes inventory of the available resources on the worker nodes and determines where incoming containers will go. Finally, the Master Node also houses the **etcd** key-value storage. The etcd has all the configuration data and status data of each node and of each container it holds. Backups are created from snapshots from the etcd. These snapshots give the Master Node the ability to recover any container or node in the cluster.

The Master Nodes are arguably the most important. They have the ability to restart or restore any part of the cluster that fails or is lost and are responsible for the greater functioning of all other nodes and containers. Worker Nodes, alternatively, tend to be larger and have the most load. This is because Worker Nodes are responsible for running applications.

**Worker Nodes**


![Master and Worker Nodes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xy86q4eaa3er6wmq00qa.jpeg)

Just like Master Nodes, Worker Nodes are made up of several different components. Each component is responsible for different functions. Firstly, each Worker Node has a **kubelet** process. The kubelet allows communication between the nodes. If there is a problem with the status of it's Worker Node, the kubelet relays this message to the Master Node, receives instructions and carries them out. 

Worker Nodes also contain any number of **containers**. A container is a single component of packaged up code and any needed dependencies. A popular container technology, often used in tandem with Kubernetes, is Docker. There may be a different number of containers in each Worker Node, depending on the distribution of the load.  

## Kubernetes Usability

Kubernetes is currently the most popular container management tool. However, before deciding on whether to use any technology, developers should assess it's usability and benefits, as well as its challenges. 

**Pros**

- Scalability: As load increases or decreases, Kubernetes can quickly scale accordingly. It can manage a wide range in number of containers and can automatically add nodes to clusters as needed. 

- Disaster recovery and self-healing: if a disaster occurs and data is lost, there are backups saved and all data can be restored. 

- Load balancing: containers are sorted into nodes after an automatic assessment of each nodes available resources.

**Cons**

- Complexity: Kubernetes is a complex technology and is not beginner friendly. It takes a minimum level of expertise to use Kubernetes, and those who do often must be explicitly trained to do so.

- Not practical for small applications or startups: Kubernetes' ideal use is managing large groups of containers for complex applications. It may not be particularly useful depending on the scale of an app. 

## Conclusion

In conclusion, Kubernetes is a popular, open-source technology that is widely used to manage large numbers of containers. It is comprised of separate, hierarchal components that control specific aspects of functioning. It is an ideal tool for complex applications. 

**Works Cited**

- https://blog.risingstack.com/the-history-of-kubernetes/#:~:text=Kubernetes%20is%20originally%20developed%20by,a%20large%20community%20of%20contributors.

- https://dl.acm.org/doi/10.1145/2741948.2741964

- https://www.datadoghq.com/container-report/#:~:text=Kubernetes%20continues%20to%20be%20the,containers%20in%20a%20growing%20ecosystem.

- https://thenewstack.io/kube-node-let-k8s-cluster-auto-manage-nodes/

- https://www.learnsteps.com/what-is-a-control-plane-what-do-people-mean-by-this-basics-on-kubernetes/

- https://platform9.com/blog/kubernetes-enterprise-chapter-2-kubernetes-architecture-concepts/