No history yet

Kubernetes Fundamentals

What is Kubernetes?

Imagine you have a complex application made of many small, independent parts called containers. Running just one or two is easy. But what happens when you have hundreds, or even thousands? How do you start them, stop them, connect them, and make sure they're all healthy? This is where Kubernetes comes in.

Kubernetes is an open-source platform that automates the management of containerized applications. It acts like an orchestra conductor for your containers, ensuring they all work together in harmony. You tell Kubernetes what you want your application to look like—for instance, "I want three copies of my web server running at all times"—and Kubernetes handles the rest. It finds a place for them to run, monitors their health, and replaces any that fail.

Kubernetes provides you with a framework to run distributed systems resiliently.

This process of managing containers at scale is called container orchestration. Kubernetes has become the industry standard for it.

Cluster Architecture

Kubernetes works by managing a cluster of computers, which can be physical machines or virtual machines. This cluster is divided into two main parts: the Control Plane and the Worker Nodes.

The Control Plane is the brain of the operation. It makes all the decisions about the cluster, like scheduling containers and responding to events.

The Worker Nodes are the muscle. They are the machines that actually run your application's containers.

The control plane manages the worker nodes and the Pods (which we'll cover soon) in the cluster. When you interact with Kubernetes, for example by using the command-line tool kubectl, you're communicating with the cluster's control plane via its API.

The Building Blocks

To work with Kubernetes, you describe the desired state of your application using objects. These objects represent what applications are running, what resources they use, and how they behave. The three most fundamental objects are Pods, Services, and Deployments.

Pod

noun

The smallest and simplest unit in the Kubernetes object model that you create or deploy. A Pod represents a single instance of a running process in a cluster and can contain one or more containers.

Think of a Pod as a logical wrapper for your containers. Containers within the same Pod share the same network resources and storage, and they can easily communicate with each other. While a Pod can run multiple containers, the most common pattern is one container per Pod.

Lesson image

Pods are ephemeral, meaning they can be created and destroyed. If a worker node fails, the Pods on that node are lost. This creates a problem: if you have a set of Pods providing a service (like a web backend), how can other applications reliably connect to them if their addresses can change?

This is where Services come in. A Service provides a stable, single point of entry to a group of Pods. It acts as a load balancer, distributing network traffic across all the Pods that match its selector. Other applications connect to the Service's stable IP address, and Kubernetes ensures the request is routed to a healthy Pod.

A Deployment is a higher-level object that manages Pods and allows you to describe your application's desired state.

While you can create Pods directly, you usually won't. Instead, you'll use a Deployment. With a Deployment, you declare how many replicas of a Pod you want to run. If a Pod or a whole node fails, the Deployment's controller will notice the number of replicas is below the desired count and automatically create a new one.

Deployments also manage updates. When you want to update your application to a new version, you simply update the container image in your Deployment object. Kubernetes will then perform a rolling update, gradually replacing old Pods with new ones, ensuring your application remains available throughout the process.

Quiz Questions 1/5

What is the primary purpose of Kubernetes?

Quiz Questions 2/5

An application's frontend needs a reliable way to connect to a group of backend Pods, even though the Pods might be created and destroyed. Which Kubernetes object should be used to provide a stable network endpoint?

These core components—the cluster architecture and the basic objects like Pods, Services, and Deployments—are the foundation of everything you do in Kubernetes.