How Kubernetes is used in Industries and What are its Use-Cases?

Ajmal Muhammed
10 min readMar 14, 2021

--

What is Kubernetes?

Kubernetes (also known as k8s or “Kube”) is an open-source container orchestration platform that automates many of the manual processes involved in deploying, managing, and scaling containerized applications.

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. Kubernetes services, support, and tools are widely available.

Why we need Kubernetes and what it can do

Kubernetes is the container orchestrator that was developed at Google which has been donated to the CNCF and is now open source. It has the advantage of leveraging Google’s years of expertise in container management. It is a comprehensive system for automating deployment, scheduling, and scaling of containerized applications, and supports many containerization tools such as Docker.

For now, Kubernetes is the market leader and the standardized means of orchestrating containers and deploying distributed applications. Kubernetes can be run on a public cloud service or on-premises, is highly modular, open-source, and has a vibrant community. Companies of all sizes are investing in it, and many cloud providers offer Kubernetes as a service. Sumo Logic provides support for all orchestration technologies, including Kubernetes-powered applications.

Containers are a good way to bundle and run your applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if a container goes down, another container needs to start.

That’s how Kubernetes comes to the rescue! Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more. For example, Kubernetes can easily manage a canary deployment for your system.

Kubernetes provides:

  • Service discovery and load balancing
  • Storage orchestration
  • Automated rollouts and rollbacks
  • Automatic bin packing
  • Self-healing
  • Secret and configuration management

With Kubernetes you can:

  • Orchestrate containers across multiple hosts.
  • Make better use of hardware to maximize the resources needed to run your enterprise apps.
  • Control and automate application deployments and updates.
  • Mount and add storage to run stateful apps.
  • Scale containerized applications and their resources on the fly.
  • Declaratively manage services, which guarantees the deployed applications are always running the way you intended them to run.
  • Health-check and self-heal your apps with auto-placement, auto restart, auto replication, and autoscaling.

Kubernetes Components

Some of the common terms to help you better understand Kubernetes.

Control plane: The collection of processes that control Kubernetes nodes. This is where all task assignments originate.

Nodes: These machines perform the requested tasks assigned by the control plane.

Pod: A group of one or more containers deployed to a single node. All containers in a pod share an IP address, IPC, hostname, and other resources. Pods abstract network and storage from the underlying container. This lets you move containers around the cluster more easily.

Replication controller: This controls how many identical copies of a pod should be running somewhere on the cluster.

Service: This decouples work definitions from the pods. Kubernetes service proxies automatically get service requests to the right pod — no matter where it moves in the cluster or even if it’s been replaced.

Kubelet: This service runs on nodes, reads the container manifests and ensures the defined containers are started and running.

kubectl: The command-line configuration tool for Kubernetes

How does Kubernetes work?

Kubernetes architecture and components

Kubernetes is made up of many components that do not know are care about each other. The components all talk to each other through the API server. Each of these components operates its own function and then exposes metrics, that we can collect for monitoring later on. We can break down the components into three main parts.

  1. The Control Plane — The Master.
  2. Nodes — Where pods get scheduled.
  3. Pods — Holds containers.

The Control Plane — The Master Node

The control plane is the orchestrator. Kubernetes is an orchestration platform, and the control plane facilitates that orchestration. There are multiple components in the control plane that help facilitate that orchestration. Etcd for storage, the API server for communication between components, the scheduler which decides which nodes pods should run on, and the controller manager, responsible for checking the current state against the desired state.

Nodes

Nodes make up the collective compute power of the Kubernetes cluster. This is where containers actually get deployed to run. Nodes are the physical infrastructure that your application runs on, the server of VMs in your environment.

Pods

Pods are the lowest level resource in the Kubernetes cluster. A pod is made up of one or more containers, but most commonly just a single container. When defining your cluster, limits are set for pods which define what resources, CPU and memory, they need to run. The scheduler uses this definition to decide on which nodes to place the pods. If there is more than one container in a pod, it is difficult to estimate the required resources and the scheduler will not be able to appropriately place pods.

The relationship between Docker and Kubernetes

Kubernetes and Docker are both comprehensive de-facto solutions to intelligently manage containerized applications and provide powerful capabilities, and from this, some confusion has emerged. “Kubernetes” is now sometimes used as a shorthand for an entire container environment based on Kubernetes. In reality, they are not directly comparable, have different roots, and solve for different things.

Docker is a platform and tool for building, distributing and running Docker containers. It offers its own native clustering tool that can be used to orchestrate and schedule containers on machine clusters. Kubernetes is a container orchestration system for Docker containers that is more extensive than Docker Swarm and is meant to coordinate clusters of nodes at scale in production in an efficient manner. It works around the concept of pods, which are scheduling units (and can contain one or more containers) in the Kubernetes ecosystem, and they are distributed among nodes to provide high availability. One can easily run a Docker build on a Kubernetes cluster, but Kubernetes itself is not a complete solution and is meant to include custom plugins.

Kubernetes and Docker are both fundamentally different technologies but they work very well together, and both facilitate the management and deployment of containers in a distributed architecture.

Difference between Docker and Kubernetes

It’s pretty common to compare Kubernetes and Docker, however, a better comparison is Kubernetes vs Docker Swarm.

Docker Swarm is an orchestration technology similar to Kubernetes. Docker Swarm is naturally tightly integrated within the Docker ecosystem and focuses on the clustering of Docker containers.

A major difference between Docker and Kubernetes is that Docker runs on a single node, whereas Kubernetes is designed to run across a cluster.

Another difference between Kubernetes and Docker is that Docker can be used without Kubernetes, whereas Kubernetes needs a container runtime in order to orchestrate.

Since its initial release in 2015, Kubernetes has been widely adopted, and at this point, has become the standard for container management and orchestration. Kubernetes provides an infrastructure-level framework for orchestrating containers at scale, and for managing user interaction with them.

In much the same way, Docker has become the standard for container development and deployment. Docker provides a platform for developing, deploying, and running containers at a much more basic, nuts-and-bolts level. It is the ground on which the Kubernetes framework sits.

Kubernetes With Docker

The truth is that although Kubernetes can use other container sources and runtimes, it is designed to work well with Docker, and much of Kubernetes’ documentation was written with Docker in mind. The most basic Kubernetes use case is Kubernetes + Docker, and Kubernetes includes Docker-centric tools such as Compose, which converts Docker Compose commands and settings so they can be used by Kubernetes.

For its part, Docker has embraced Kubernetes, and has, in fact, offered its own integrated Kubernetes distribution. The sale of Docker Enterprise to Mirantis in late 2019 (along with Docker’s own renewed focus on developer-oriented tools) even more sharply emphasized Docker’s reliance on Kubernetes and other container infrastructure providers. This is underscored by Mirantis’ stated intention to phase out Docker Swarm and establish Kubernetes as the default orchestration tool for Docker Enterprise.

The bottom line is that Kubernetes and Docker are both industry standards in their respective core areas of expertise, and together they provide a well-integrated platform for container management, deployment, and orchestration at scale.

How Spotify is migrating from an in-house Docker orchestration platform to Kubernetes

With 170 million active users and 25 million songs, Spotify is the world’s largest music streaming subscription service. Undergirding the 1 billion plays per day is a digital infrastructure that is slowly shifting.

Spotify open-sourced its in-house container orchestration service, Helios, in 2014. After several years of use, Spotify decided to make the switch from Helios to Kubernetes, another orchestration service released shortly after that has since become the de-facto orchestrator platform.

Backed by thousands of developers, Kubernetes comes with a huge ecosystem behind it, and trying to reach feature parity with an in-house system not widely adopted by other enterprises is difficult, even for a business as large as Spotify, according to James Wen, site reliability engineer for Spotify, speaking at DevFest DC last week.

By moving to Kubernetes, the benefits of Spotify is:

  • Cloud-native “magic,” such as autoscaling, better resource utilization, and self-healing
  • Less capacity planning for developers
  • Less proprietary technology
  • Faster experimentation and operations

Spotify continues to expand its use of Kubernetes on a monthly basis since its adoption a few years ago. Previously, Spotify had already begun to shift its operation to a containerized infrastructure before it began to consider the potential benefits Kubernetes might offer.

“When we originally looked at Kubernetes, we were in an interesting situation, because we had already had an in-house orchestration solution we had built, and, anecdotally, launched the very same week an open-source [alternative] when Kubernetes was launched,” said Haughwout. “So we did a lot of work to essentially make the transition to Kubernetes incredibly easy for developers, and to make it so that we could have hundreds of teams work across shared clusters securely and safely together.”

Despite its early adoption, Spotify began to shift to Kubernetes “in earnest” about a year and a half ago. Kubernetes has since played a key role in Spotify’s DevOps in two key ways. This includes how the platform has helped to “reduce toil,” said Haughwout.

“We want to take away the need for engineers, who have to manage infrastructure, to worry about scaling up and down so they can just simply build and deploy features,” he explained.

The second main benefit Kubernetes has provided is how the adoption of a cloud-native infrastructure has enabled the music streaming giant to add a number of new tools and platforms to improve its production pipeline and operations. “One of the big reasons that we’ve been working diligently with the Cloud Native Computing Foundation is to make it easy to adopt a lot of infrastructures,” Haughwout said. “Kubernetes has become a kind of lingua franca of cloud-native technology that opens the door for us to get into lots of other technologies.”

How Spotify did it and still are doing it

Spotify decided to start small, experimenting with running one service on one Kubernetes cluster and then moving up to three services on a shared cluster for a few days.

Spotify continues to expand its use of Kubernetes on a monthly basis since its adoption a few years ago. Previously, Spotify had already begun to shift its operation to a containerized infrastructure before it began to consider the potential benefits Kubernetes might offer.

Despite its early adoption, Spotify began to shift to Kubernetes in earnest about two years ago. Kubernetes has since played a key role in Spotify’s DevOps in two key ways. This includes how the platform has helped to reduce toil. The second main benefit Kubernetes has provided is how the adoption of a cloud-native infrastructure has enabled the music streaming giant to add a number of new tools and platforms to improve its production pipeline and operations.

During the past year, Spotify has been expanding the number of services it runs on Kubernetes while taking advantage of its highly distributed structures. For example, how Spotify moved data pipelines and machine learning to Kubernetes and “relies on it to build ephemeral environments.” Moving forward, the company still has to tackle a few challenges, including cluster management, multicluster operations in each region, and building up support for data jobs, machine learning workloads, and GPU workloads.

Moving step by step with steadily increasing goals, instead of a single, monolithic migration, allowed Spotify to steadily increase scope and complexity and handle unknown factors at a manageable pace, keeping morale for developers up.

--

--

No responses yet