Quick understanding of Kubernetes Architecture and Terminology for Beginners
An Introduction to Kubernetes
Kubernetes is a powerful open-source system, initially developed by Google, for managing containerized applications in a clustered environment. It aims to provide better ways of managing related, distributed components and services across varied infrastructure.
What is Kubernetes ?
Kubernetes, at its basic level, is a system for running and coordinating containerized applications across a cluster of machines. It is a platform designed to completely manage the life cycle of containerized applications and services using methods that provide predictability, scalability, and high availability.
Need for Kubernetes?
To understand the need for Kubernetes , first we need to understand the drawback of Containers.
Containers are good it can be either Linux or Docker Container they all do one thing , they package your application and isolate from host mainly. This makes the container fast , reliable , efficient , light- weight and scalable.
Here is the point, after we scale up the containers what actually happens after that?
- Containers has to be managed carefully
- Containers could not communicate with each other
- Containers has to be deployed appropriately
- Auto scaling was not possible with containers
- Distributing traffic was still challenging
So, we need something that is capable of managing all the containers , analyze your traffic and auto scaling container when required. This is where Kubernetes good at in Market.
Kubernetes is an open source Container Management tool which automates container deployment , container scaling and container load balancing.
It works good with all the cloud vendors (Public or Hybrid) & on-premises.
Features of Kubernetes :
- Automatic Bin packing : Packages your application and automatically places containers based on their requirement and resources available.
- Service Discovery & Load Balancing : Automatically assigns containers their own IP and single DNS name for the set of containers. Load balancing is achieved across all the containers.
- Storage Orchestration : Automatically mount your storage system or your choice you can choose that local or public cloud.
- Self Healing : Whenever Kubernetes realize that one of the container has failed, then it automatically restarts the container on its own. In case if node itself fails then those containers would be started in another node (you need to have more nodes in that cluster)
- Secret & Configuration Management : With Kubernetes we deploy and update secrets and application configuration without having to rebuild your entire image. Without exposing your secrets in your stack config.
- Batch Execution : Can also manage batch and CI work load , more of DevOps role.
- Horizontal Scaling : Scale your applications up and down easily with a simple commands or dashboard.
- Automation Rollbacks and Roll outs: When ever there is an update on your application that you want to release , Kubernetes progressively rolls out those changes and updates to the application or its configurations by ensuring that one instance after the other sent these updates. Makes sure that not all the instances are updated at the same time thus ensuring there is a high availability of application. Even if something goes wrong then it will roll back that change for you.
Pods
A Kubernetes pod is a group of containers, and is the smallest unit that Kubernetes administers. Pods have a single IP address that is applied to every container within the pod. Containers in a pod share the same resources such as memory and storage. This allows the individual Linux containers inside a pod to be treated collectively as a single application, as if all the containerized processes were running together on the same host in more traditional workloads. It’s quite common to have a pod with only a single container, when the application or service is a single process that needs to run. But when things get more complicated, and multiple processes need to work together using the same shared data volumes for correct operation, multi-container pods ease deployment configuration compared to setting up shared resources between containers on your own.
Deployments
Kubernetes deployments define the scale at which you want to run your application by letting you set the details of how you would like pods replicated on your Kubernetes nodes. Deployments describe the number of desired identical pod replicas to run and the preferred update strategy used when updating the deployment. Kubernetes will track pod health, and will remove or add pods as needed to bring your application deployment to the desired state.
Services
The lifetime of an individual pod cannot be relied upon; everything from their IP addresses to their very existence are prone to change. Kubernetes doesn’t treat its pods as unique, long-running instances; if a pod encounters an issue and dies, it’s Kubernetes’ job to replace it so that the application doesn’t experience any downtime.
A service is an abstraction over the pods, and essentially, the only interface the various application consumers interact with. As pods are replaced, their internal names and IP’s might change. A service exposes a single machine name or IP address mapped to pods whose underlying names and numbers are unreliable. A service ensures that, to the outside network, everything appears to be unchanged.
Nodes
A Kubernetes node manages and runs pods; it’s the machine (whether virtualized or physical) that performs the given work. Just as pods collect individual containers that operate together, a node collects entire pods that function together. When you’re operating at scale, you want to be able to hand work over to a node whose pods are free to take it.
Master Server Components
API Server
The API server exposes a REST interface to the Kubernetes cluster. All operations against pods, services, and so forth, are executed programmatically by communicating with the endpoints provided by it.
Scheduler
The scheduler is responsible for assigning work to the various nodes. It keeps watch over the resource capacity and ensures that a worker node’s performance is within an appropriate threshold.
Controller-Manager
The controller-manager is responsible for making sure that the shared state of the cluster is operating as expected. More accurately, the controller manager oversees various controllers which respond to events (e.g., if a node goes down).
Worker Node Components
Kubelet
A Kubelet tracks the state of a pod to ensure that all the containers are running. It provides a heartbeat message every few seconds to the master server. If a replication controller does not receive that message, the node is marked as unhealthy.
Kube Proxy
The Kube proxy routes traffic coming into a node from the service. It forwards requests for work to the correct containers.
etcd
etcd is a distributed key-value store that Kubernetes uses to share information about the overall state of a cluster. Additionally, nodes can refer to the global configuration data stored there to set themselves up whenever they are regenerated.
Conclusion
By understanding how the basic building blocks fit together, you can begin to design systems that fully leverage the capabilities of the platform to run and manage your workloads at scale.