DEV Community

loading...

An Introduction to the Kubernetes

Mert Simsek
#gnu/linux #symfony #googlecloud #docker
・4 min read

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

  • Docker Swarm
    It is a container orchestrator provided by Docker, Inc. It is part of Docker Engine.

  • Kubernetes
    Kubernetes was started by Google, but now, it is a part of the Cloud Native Computing Foundation project.

  • Mesos Marathon
    Marathon is one of the frameworks to run containers at scale on Apache Mesos.

  • Amazon ECS
    Amazon EC2 Container Service (ECS) is a hosted service provided by AWS to run Docker containers at scale on its infrastructrue.

  • Hashicorp Nomad
    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

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

 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.

Discussion (3)

Collapse
david_j_eddy profile image
David J Eddy

Nice intro, I look forward to the next part!

Collapse
soasme profile image
Ju

Nice one. My post around k8s is more focusing on every single concept. It's good to compare and read the two. dev.to/soasme/kubernetes-in-a-nuts...