In previous posts, we discussed some fundamentals of containers and Docker. Let's talk about Kubernetes in this article.
To quote the official documentation, Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem.
In this article, I will introduce Kubernetes and discuss its fundamentals. Kubernetes is currently in high demand in the IT industry. To understand what is Kubernetes, first understand "Why" Kubernetes? Let's go back in time to see why Kubernetes is so useful.
Decades back, organizations used physical servers to run applications. In a physical server, there was no way to define resource boundaries for applications, which caused resource allocation issues. For example, if multiple applications run on a physical server, one application may consume the majority of the resources, causing the other applications to underperform. One solution would be to run each application on a separate physical server. However, this did not scale because resources were underutilized, and it was costly for organizations to maintain a large number of physical servers.
To solve this issue, Virtualization was introduced. It enables you to run multiple Virtual Machines (VMs) on a single physical server. Virtualization isolates applications between VMs and adds security by preventing one application's information from being freely accessed by another. It allows for better resource utilization in a physical server, better scalability because applications can be easily added or updated, lowers hardware costs, and much more.
Although VMware solved many of the physical infrastructure issues and helped in making better use of our resources, there were still some issues. Each VM required some OS to install and run an application and each OS had some resource requirement, dependency on hardware and so on.
To overcome these challenges, Docker, Inc. introduced Containers which could share physical resources from the host OS and eliminated the need to create VMs. Containers are similar to virtual machines (VMs), but they have relaxed isolation properties that allow them to share the operating system (OS) among applications. Similar to a VM, a container has its own filesystem, share of CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions.
It may be simple to deploy a container, but operationalizing containers at a major scale, particularly in conjunction with microservices and multiple cloud providers is a challenge. Also, in a production environment, you need to manage large number of containers running different applications ensuring that there is no downtime. e.g. if a container goes down, another container needs to start.
That's when the need for another key innovation was born which was the container orchestration system. A container orchestration system enables the user to manage the deployment of containerized applications effectively. That's how Kubernetes comes to the rescue! Kubernetes manage containerized applications in production at scale, whether it's on-premises or on a public cloud. It provides deployment patterns, takes care of scaling and failover for your application, and so on.
What does Kubernetes do?
By automating tasks, controlling resources, and abstracting infrastructure, Kubernetes manages the entire lifecycle of container-based applications. Container-based development is popular among developers because it allows them to break down monolithic applications into more manageable microservices. Kubernetes enables their work to flow seamlessly from development to production, resulting in shorter time-to-market for a company's applications. Kubernetes provides below features -
1. Service discovery
Kubernetes can expose a container by using either its DNS name or its own IP address.
2. Load balancing
If there is a lot of traffic to a container, Kubernetes can load balance and distribute the network traffic to keep the deployment stable.
3. Storage orchestration
Kubernetes allows you to automatically mount your preferred storage system, such as local storage, public cloud providers, and others.
4. Automated rollouts and rollbacks
Kubernetes allows you to describe the desired state for your deployed containers, and it can change the actual state to the desired state at a controlled rate. For example, you can use Kubernetes to automate the creation of new containers for your deployment, the removal of existing containers, and the adoption of all their resources to the new container.
5. Self-healing
Kubernetes restarts failing containers, replaces them, kills containers that do not respond to your user-defined health check, and does not advertise them to clients until they are ready to serve.
6. Secret and configuration management
Kubernetes allows you to store and manage sensitive data like passwords, OAuth tokens, and SSH keys. Secrets and application configuration can be deployed and updated without rebuilding your container images or exposing secrets in your stack configuration.
What Kubernetes is not -
Kubernetes is not your typical PaaS (Platform as a Service) platform. Because Kubernetes operates at the container level rather than the hardware level, it provides some features that are common to PaaS offerings, such as deployment, scaling, and load balancing, and it allows users to integrate their logging, monitoring, and alerting solutions. However, Kubernetes is not a one-size-fits-all solution, and these default solutions are optional and pluggable. Kubernetes provides the building blocks for developing developer platforms while preserving user choice and flexibility where possible.
Kubernetes, unlike PaaS, does not:
1. Limit the types of applications supported or require a dependency handling framework
2. Deploy source code and does not build applications, but it can be used to create CI/CD pipelines.
3. Manage and provision certificates for containerized applications.
4. Provide application-level services, such as middleware, databases, and storage clusters These components can be integrated with k8s via add-ons.
5. Mandate applications to be written in a specific programming language, nor does it specify a specific configuration language/system.
I'll conclude this article with this small piece of information.
Stay tuned for more stuff on Kubernetes in the next few blogs.
Thank you for reading!
*** Explore | Share | Grow ***
Comments