An Introduction to the Kubernetes
Tags: kubernetes, devops, docker, beginners
Published: 2018-12-25 22:51:46

---
title: An Introduction to the Kubernetes
published: true
description: In this article, my goal is to get purpose of Kubernetes, to understand philosophy.
tags: #kubernetes #devops #docker #beginners
---

In this article, my goal is to get purpose of Kubernetes, to understand philosophy. If i need to tell a little bit, The all ways lead the dependencies. Imagine that, you've a software project. All classes are depend on each other. At this point, **Dependency Injection** might be solution well. Let's look from out of the box a little bit. Let's get a Php project. We need to have other libraries, packages which have written by other programmers. Yes, you know the answer. **Composer** is the best solution for us. Before the saying, "perfect!" in fact, we still have a dozen dependencies. The services of operation systems, they are able to be Nginx, Mysql, Rabbitmq, Redis etc. It's not finish. Directly, we're up to the operation system. In addition, network? The solution is for like these things, **Docker**. But, again, there are a few confusing problems to manage plenty of containers. For this, fortunately, we've met container orchestration like **Kubernetes**.

I will give a brief introduction to the Kubernetes and demonstrate which problems that can be solution.

Basically, Kubernetes is container orchestration. Container orchestration is ensures to manage our containers. We are able to run containers on a single computer to develop or test applications. Yet, when we run production, our priorities vary. 

- Is it durable for errors?
- Scalability.
- Using the machine resources as little as possible.
- Are accessible from the external. 
- Can we update/rollback without any downtime. 

Container orchestrators are the systems which help us for all of these. There are many container orchestrators available.

![alt text](https://thepracticaldev.s3.amazonaws.com/i/wqqneqs3w0jyifru0nr2.jpg "")

- <a href="https://docs.docker.com/engine/swarm/" target="_blank">Docker Swarm</a>
    It is a container orchestrator provided by Docker, Inc. It is part of Docker Engine.

- <a href="https://kubernetes.io/" target="_blank">Kubernetes</a>
    Kubernetes was started by Google, but now, it is a part of the Cloud Native Computing Foundation project.

- <a href="https://mesosphere.github.io/marathon/" target="_blank">Mesos Marathon</a>
    Marathon is one of the frameworks to run containers at scale on Apache Mesos.

- <a href="https://aws.amazon.com/ecs/" target="_blank">Amazon ECS</a>
    Amazon EC2 Container Service (ECS) is a hosted service provided by AWS to run Docker containers at scale on its infrastructrue.

- <a href="https://www.hashicorp.com/" target="_blank">Hashicorp Nomad</a>
    Nomad is the container orchestrator provided by HashiCorp.


From now on, let's talk about Kubernetes a litte bit. According to the Kubernetes website. By the way, Kubernetes is also referred to as k8s, as there are 8 characters between k and s.

`"Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications."`


Kubernetes offers a very rich set of features for container orchestration. Some of its fully supported features. Kubernetes has written with Go programming language.

- **Automatic binpacking**
Kubernetes automatically schedules the containers based on resource usage and constraints, without sacrificing the availability.

- **Self-healing**
Kubernetes automatically replaces and reschedules the containers from failed nodes. It also kills and restarts the containers which do not respond to health checks, based on existing rules/policy.

- **Horizontal scaling**
Kubernetes can automatically scale applications based on resource usage like CPU and memory. In some cases, it also supports dynamic scaling based on customer metrics.

- **Service discovery and Load balancing**
Kubernetes groups sets of containers and refers to them via a Domain Name System (DNS). This DNS is also called a Kubernetes service. Kubernetes can discover these services automatically, and load-balance requests between containers of a given service.

- **Secrets and configuration management**
Kubernetes can manage secrets and configuration details for an application without re-building the respective images. With secrets, we can share confidential information to our application without exposing it to the stack configuration, like on GitHub.

Before we dive into Kubernetes, we need to stay intouch with **Cloud Native Computing Foundation.**

![alt text](https://thepracticaldev.s3.amazonaws.com/i/5xmv68d2tf4iar48jv1u.png "")

The Cloud Native Computing Foundation (CNCF) is one of the projects hosted by The Linux Foundation. CNCF aim to accelerate the adoption of containers, microservices, and cloud-native applications.CNCF provides resources to each of the projects, but, at the same time, each project continues to operate independently under its pre-existing governance structure and with its existing maintainers.

We will see the Kubernetes architecture, the different components of the master and worker nodes, the cluster state management with etcd and the network setup requirements. We will also talk about the network, which is used by Kubernetes. 

![alt text](https://thepracticaldev.s3.amazonaws.com/i/yn4fjjyq1i5qyecpxju6.png "")

### Master Node ###
The master node is responsible for managing the Kubernetes cluster, and it is the entry point for all administrative tasks. We can communicate to the master node via the CLI, the GUI (Dashboard), or via APIs.

### Worker Node ###
A worker node is a machine (VM, physical server, etc.) which runs the applications using Pods and is controlled by the master node. Pods are scheduled on the worker nodes, which have the necessary tools to run and connect them. A Pod is the scheduling unit in Kubernetes.


### To Conclusion ###
We will dive deeper into this in future chapters. Kubernetes might be the best solution for you, you are supposed to measure your target basically. Further, we'll discuss **Master Node** and **Worker Node**. Thus, after that, we are going to encounter topics which confusing.