Welcome to the DevOps Digest! If you are interested in containerization and orchestrating containerized applications at scale, then you have come to the right place. In this blog, we will provide you with a comprehensive introduction to Kubernetes, including what it is, why it's important, and how it works. Whether you are a developer, an operations professional, or just someone curious about the latest trends in technology, this blog will help you understand the fundamental concepts of Kubernetes and why it has become so popular.
Kubernetes is a container orchestration technology used to orchestrate the deployment and management of hundreds and thousands of containers in a clustered environment.
Node: It is a machine (physical or virtual on which Kubernetes is installed. It is a worker machine where a container will be launched by Kubernetes.
Cluster: It is a set of nodes grouped together. So, even if one node fails, we have our application still accessible from the other nodes. It also helps in sharing loads as well.
Master: It is another node with Kubernetes installed in it and is configured as a Master. It watches over the nodes in the cluster and is responsible for the actual orchestration of containers on the worker nodes.
Manage the cluster
Stores the information about the members of the cluster
Monitor the nodes
Components:
API Server: It acts as the frontend for kubernetes. The user, management devices, and command line interfaces all talk to the API server to interact with kubernetes clusters.
etcd: It is a distributed reliable key-value store used by kubernetes to store all data used to manage the clusters.
Responsible for implementing locks within the cluster to ensure that there are no conflicts between the masters.
When you have multiple nodes and multiple masters in your clusters, etcd, stores all that information on all the nodes in the cluster in a distribution manner.
Scheduler: It is responsible for distributing work or containers across multiple nodes. It looks for newly created containers and assigns them to nodes
4. Controllers: (Brain behind Orchestration)
They are responsible for noticing and responding when nodes, containers or endpoints go down
They make the decision to bring up new containers
5. Container Runtime: It is the underlying software that is used to run containers. e.g. Docker
6. Kubelet: It is an agent that runs on each node in the cluster.
Kubernetes doesn't deploy containers directly on the worker nodes.
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes
Pods usually have a one-to-one relationship with containers running your application
To scale up, you create new Pods and to scale down, you delete existing Pods
Q: Can a Pod only have a single container?
No, a single Pod can have multiple containers except for the fact that they're usually not multiple containers of the same kind.
Those containers can also communicate with each other directly by referring to each other as localhost since they share the same network space. They can also easily share the same storage space as well.
(pod-defination.yml)
A kubernetes definition file always contains 4 top level fields.
Kind |
Version |
---|---|
POD |
v1 |
Service |
v1 |
ReplicaSet |
apps/v1 |
Deployment |
apps/v1 |
kind: It refers to the type of object we are trying to create. e.g. POD, Service, ReplicaSet, Deployment.
Metadata: It is the data about the object like its name labels, etc. As you can see, metadata is in the form of a dictionary.
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: nginx
In conclusion, Kubernetes has become the go-to solution for container orchestration, enabling organizations to deploy, manage, and scale containerized applications with ease. With its robust feature set and flexibility, Kubernetes has gained widespread adoption across industries and has revolutionized the way modern software is developed, deployed, and managed. Whether you are a developer, an operations professional, or just someone curious about the latest trends in technology, understanding Kubernetes is essential in today's tech landscape. We hope this introduction has given you a solid foundation to start exploring the world of Kubernetes and its possibilities.