Hearing a lot about Kubernetes but not sure what they are?
What is Kubernetes?
Kubernetes is an open-source tool which takes care of container orchestration. It automates container deployment, continuous scaling, and de-scaling, container load balancing, etc.
Google has initially developed Kubernetes on the Go programming language.
Currently, it is the market leader in orchestrating containers. Kubernetes is an ideal platform for hosting microservices applications that scale dynamically. When you are working on a production environment, Kubernetes is the most preferred and safer platform for container orchestration.
Because in a production environment, you expect zero downtime, your cluster should always be up and running.
With Google Cloud Platform (GCP), you can launch Kubernetes in just a few clicks. It is supported by other cloud providers, also like AWS and Azure. And, there are multiple managed Kubernetes platform available.
Earlier, a fight between developers and testers was a common thing.
The environments used to be different for them; what worked on the developer’s system did not run on the testers system.
Now that most organizations use containers, the issues appearing because of differences in the environment do not occur anymore.
But organizing and running multiple containers is also not an easy task. When you are working on dynamic applications, scaling up/down, the number of containers is a regular thing. Doing such tasks manually can be complex and risky. Hence, a container orchestration tool is required, and that is why Kubernetes is needed.
There are plenty, but the following are some of the best ones.
# Automatic Bin Packing
Kubernetes packages your application, and it automatically places containers based on their requirements and the available resources
# Service Discovery and Load Balancing
Kubernetes automatically assign containers their IP addresses and a DNS name to the containers running logical operations. Load Balancing feature is also present between the set of containers.
# Storage Orchestration
Kubernetes automatically mounts the storage system of your choice. It can be either local storage or a public cloud provider such as AWS.
# Self Healing
Whenever Kubernetes realizes that one of your containers has failed, it will restart that container on its own also create a new container in place of the crashed one. In case your node fails, the containers running on that node will get started on another running node in the cluster.
# Horizontal Scaling
You can scale your applications up and down quickly with a simple command. The simple command can be run on the CLI or through the Kubernetes dashboard. Auto-scaling is also possible, based on the CPU usage, your containers would automatically be scaled up or scale down.
# Automatic Rollback and Rollout
Whenever there’s an update to your application, Kubernetes progressively rolls out these changes and updates to the application or its configurations. Not all instances are updated at the same time, thus ensuring there is high availability. If something goes wrong, then Kubernetes will roll back that changes immediately.
Learn how to install and set up Kubernetes.
Before you get your hands dirty, you need to know a few terminologies used in Kubernetes regularly.
It represents one or more containers running in a cluster.
An abstract way to access pod/application.
It is used to remove name collision within a cluster. It supports multiple virtual clusters on the same physical cluster.
Kubernetes worker machine.
Consisting of a group of nodes running containerized applications on Kubernetes.
A label for storing data required by resources.
It is the data directory that containers in pod access.
Several replicas of running pods.
Giving a name to Kubernetes objects so that it can be identified across the system.
It is an agent that runs on each node and checks if the containers are running in the pods.
Command-line utility to interact with the Kubernetes API server.
Network proxy which contains all the network rules on each node in the cluster.
Kubernetes and Docker
Now you might be thinking, how Kubernetes is different than Docker. The phrase Kubernetes vs. Docker can be misleading.
Docker is a platform that packages OS, libraries, and applications inside a container. Let me tell you that Docker does the same thing which it is meant to do in Kubernetes. But when you work with just Docker, everything is manual. You need to start and stop containers manually. But with Kubernetes, everything gets automated.
Kubernetes can schedule pods which have containers, Kubelet then tells Docker to start or stop containers. Kubelet in Kubernetes is responsible for monitoring those containers and collecting their information on the master node. So, the basic difference is instead of admin guys telling Docker what to do, in Kubernetes, it is all automated.
There is another tool used for container orchestration is Docker Swarm. So, what’s the difference between them?
Kubernetes vs. Docker Swarm
|Installation is complex||Installation is simple|
|Bigger Open source community||Smaller community compared to Kubernetes|
|Can orchestrate 100s of containers easily||Good for orchestrating 10-20 containers|
|Kubernetes Dashboard provides GUI||No GUI|
|Supports auto-scaling||Does not support auto-scaling|
|Supports rolling updates with automatic rollback||Supports rolling updates but not automatic rollback|
|Logging and Monitoring available in-built||Needs 3rd party like ELK for Logging and Monitoring|
|Can share volume with containers in the same pod||Can share volume with any container in the cluster|
I hope now you have a basic understanding of what is Kubernetes and how it helps. If you into DevOps or thinking to get into, then I would suggest taking this fantastic Udemy course to learn Kubernetes.