How Does Kubernetes Work and How is it Used?
Kubernetes is at the core of modern technology solutions: from OpenAI's work creating cutting edge tech like ChatGPT, to its use on unmanned aircraft, and the everyday needs of Chick-fil-A, who run it at their restaurants It’s likely you’ve heard the word Kubernetes mentioned before today, and you might even have some basic idea of why it’s used. In this article we will explore what this technology is all about and how its capabilities can help overcome some of the key challenges of modern IT.
What is Kubernetes?
“Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications”. That’s the overview from the project's website. For someone completely new to this technology, that might not exactly be an intuitively understood explanation. If this is your first time hearing about K8s, the best way to begin to understand it is with an analogy.
Shipping modern software is a bit like shipping goods around the world. Shipping containers revolutionized the goods transportation industry. These standardized, durable, and stackable metal boxes provide a common standard. Regardless of the contents inside, the containers offer consistency and enable ease of transportation (on ships, trains, trucks, etc).
By requiring goods to be loaded into these containers, cranes, forklifts, and other equipment can load, unload, and transport goods efficiently. Machines can automate and streamline the movement of containers, minimizing human effort and speeding up the overall delivery process
In a similar way, Kubernetes serves as a standardized way to handle automated management of software containers in the world of computing. Kubernetes provides a common language and framework to simplify complexities of distributed software management. It allows for the seamless deployment of containerized software across different environments, whether it’s on-premises, in the cloud, or at the edge.
Why is Kubernetes called K8s?
A quick aside to clear one more potential point of confusion, K8s is an abbreviation of Kubernetes. Replacing the ‘ubernete’ with the digit 8 (representing those 8 letters) and adding an ‘s’ became a popular shorthand for the technology, one that has stuck with it over the years. Kubernetes actually means “helmsman” or “pilot” in Greek, but rather than potentially stumble over the proper pronunciation, users and developers often favor the three character alternative.
A brief history of Kubernetes
The concepts that would become Kubernetes were born through attempts at tackling the problems with running software at scale. Google was one of the first organizations to run containers across its organization, starting well before it made Kubernetes open source.
Kubernetes was built on 15 years of Google’s efforts running containerized workloads, along with contributions from the open source community. Its origin traces back to an internal cluster management system named Borg that could run hundreds of thousands of jobs on clusters of up to tens of thousands of machines.
In 2014, Google open sourced Kubernetes. Notably, Red Hat also became a core contributor to the Kubernetes project in 2014. In 2015, this work surfaced in the release of OpenShift 3, which had been re-architected to use Docker containers and Kubernetes.
By 2017, Kubernetes had gained widespread recognition and adoption at major tech companies and enterprises. In 2018, major cloud providers AWS and Azure made managed services for Kubernetes generally available. Fast forward to today and K8s has evolved to support emerging workload use cases like hybrid cloud, 5G, IoT/Edge and AI/ML.
If you want to learn more on the history of Kubernetes, check out this documentary , it’s full of historical insights from many original Kubernetes contributors.
Key elements of Kubernetes
To put it simply, Kubernetes can be used to run and manage applications almost anywhere. It automates the operational tasks of container management that would otherwise be manual, repetitive, and error prone. Let’s dig into some of the top concepts that are core to the technology.
Abstraction from the underlying hardware – Kubernetes sits above the hardware and handles the compute, networking, and storage for your running containers. This greatly streamlines and standardizes the way developers and operations teams manage apps. Machine hardware becomes a “node” and is grouped together with other machines into a “cluster”.
Workloads, scheduling, and health – Kubernetes orchestrates applications by wrapping containers in what we call a “pod”. But what is a pod in Kubernetes? A pod (like a pea pod) lets users provide information that specifies how to run one or more containers. For example, a pod spec might say to run the Apache HTTP web server, expose port 8080, and mount storage to /web/data. We can also use a pod to specify health checks that are used by Kubernetes to restart failing containers and give hints to networking services so unhealthy apps don’t get user traffic.
Service discovery, autoscaling, and load balancing – Running many containers across multiple machines requires some complex workload and networking management. Nodes can come and go, pods can be created and destroyed, applications can be horizontally scaled.
You don’t want to have to write config or code to deal with all that. Kubernetes provides a number of different constructs including a “service” definition. This allows us to simplify and automate away networking management complexity.
Security and Resource Policy – By default, pods run with unbounded access to all compute resources on a cluster. Kubernetes lets you specify policies to manage behavior of security and resource usage. Some examples of this are: isolating pod to pod communication, creating CPU core usage quotas for a group of users, and specifying that a pod requires a GPU to run.
How does Kubernetes work?
All those capabilities covered in the last section come from system components that run when you install Kubernetes and create a cluster. The architecture diagram below shows how things fit together at a high level; let’s break it down.
An architecture diagram showing the elements of a typical Kubernetes cluster.
On the far right side you see what matters the most, users of your applications and services running in the cluster. Typically, those users will be accessing web apps using their browser which goes over HTTP/S. However, this could also be using different protocols and could also be service-to-service communications.
Next, the Apps that have been deployed to Kubernetes are wrapped in a pod, which is represented by the purple boxes in the diagram. You can see in the diagram a whole variety of different types of applications: Node.js apps, .NET apps, Redis caching, various Java apps, etc. Of course there are many more things you could run in pods than we could fit in the diagram.
All those pods are inside in a bigger box labeled Node – each node is just a physical machine, VM, or cloud instance. Finally, on the far left the Control Plane provides a number of components that manage all the Nodes and Pods in the cluster. For this short article, we’ve kept it high level, to give you a simple way to think about it visually. If you want a slightly deeper introduction to the architectural components, check out this link.
Just Kubernetes is not enough
While the Kubernetes project provides an amazing core capability, most organizations will need to, integrate additional components (e.g. logging, metrics, CI/CD) for a fully capable container platform. Kubernetes itself was created to be the core of a platform, not the complete solution. That is where vendor solutions like Red Hat’s OpenShift come in.
OpenShift brings the additional capability and components that are typically desired to operate Kubernetes in production enterprise environments. Some examples of this are:
Continuous integration, delivery, and deployment (CI/CD) pipelines
Tools to turn source code into containerized images
Scalable networked registry to store container images for multiple clusters to use
Distributed logging, search, visualization to have a single place for logs
Distributed metrics, alerting, and dashboards to allow automations and observability
Catalog of deployable software from independent software vendors to accelerate work
Security hardening of OS, Kubernetes, base containers, networking, and trusted certs
Kubernetes moves from the datacenter to the edge
So far we’ve covered the traditional use case of Kubernetes operating larger groups of machines clustered together in a cloud or data center. However, an emerging use of Kubernetes is for smaller form factor hardware and hardware needed at the edge. Being able to bring compute to edge locations can solve data problems and create new opportunities for innovation.
Leveraging Kubernetes as a common component allows for approaching challenges using an open hybrid platform, which means you can consistently architect your technology infrastructure from the datacenter to the edge.
In support of these needs, Red Hat’s MicroShift is designed to cleanly layer on top of an edge-optimized RHEL OS. MicroShift allows for efficient and scalable deployment of Kubernetes at the edge, bringing the benefits of containerization and declarative state orchestration to edge computing scenarios. It’s an option that lives between using minimal, standalone Linux devices and full OpenShift/Kubernetes clusters.
Red Hat allows containers and Kubernetes to be applied in a variety of edge focused footprints. The diagram below shows high level architecture options for getting Kubernetes into edge and decentralized data center locations using OpenShift and MicroShift.
Architecture options for getting Kubernetes into edge and decentralized data center locations using Red Hat OpenShift and MicroShift.
Is Kubernetes a good fit for my program/project?
This is a great question! Containers almost certainly are a good fit for most modern software deployments. The additional overhead of Kubernetes is great for some use cases and overkill for others. Some questions you can ask to start guiding your decision are:
Are you planning to deploy and manage multiple containers or microservices as part of your application architecture?
Will your application benefit from automated deployment and rollout of updates or new features?
Do you have a need for easy horizontal scaling of your application to accommodate increased traffic or demand?
Are you planning to deploy your application across multiple environments (e.g., development, staging, production) needing consistent configuration management?
Do you need automated load balancing and service discovery capabilities?
Do you have a large number of apps and services that could all run on the same hardware footprint but the manual networking and environment configuration is too complex?
I’d suggest running your specific use case by a subject expert and let them explain any potential tradeoffs to help guide the decision making.
Red Hat OpenShift and OnLogic
OnLogic, in partnership with Red Hat, delivers a compelling value proposition for a dependable hardware and software combination. OnLogic provides robust, purpose-built hardware solutions that are optimized for demanding industrial environments, edge computing, and IoT applications. By combining OnLogic’s reliable hardware with OpenShift’s comprehensive platform, enterprises can leverage Kubernetes and containers for consistent, reliable and resilient solutions to a wide range of business challenges.