Let's Explore Kubernetes:

Kubernetes

Learning Objectives

Understand how Kubernetes is used to effectively manage multiple containers at scale

Develop strategic oversight of Kubernetes configuration and deployment practices

Acknowledge the benefits of Kubernetes; self-healing, smart decision-making and flexible scheduling

In this section:

Introduction

Now we have standardised recipes and menus to help create meals at scale in the restaurant, Poppy proposes defining some new roles and responsibilities in the restaurant and using this alongside the digitised restaurant management system she setup to coordinate staff and manage the day to day logistics.

She plans to use the digitised restaurant management system to calculate logistical information and automate processes where she can, and the system will act as away to keep all staff members alligned in completing each customer's order.

In this section:

What is Kubernetes?

The Prep Chefs prepare all of the ingredients and kitchen utensils for the Patty’s to be made into delicious burgers, and the customers can order off the brand new menus which offer them flexibility and the ability to customise their orders.

But how is all of this managed? How do the ingredients get to the dining area? And how can Tommy see real time data of how the restaurant is performing?

Tommys restaurant relies on the digitised restaurant management system to manage the full restaurant coordination and logistics along with the defined roles and responsibilities of all of his staff. No matter how many customers Tommy has, this allows Tommy to cater to their needs.

Kubernetes is a container orchestration system that helps manage and coordinate the deployment, scaling and operations of containers across a cluster of machines or nodes. It utilises various components in its architecture to match the current state of the system with a desired state.

The digitised restaurant management system is made up of multiple components which work together to ensure the restaurant is operating efficiently and maintaining customer satisfaction. The Front Desk focuses on managing and controlling the restaurant operations, ensuring the staff can coordinate between each other whilst managing the restaurant. The Tables are where the actual cooking takes place and enhances the customer experience.

Let's explore the roles of the staff and the responsibilities they have in both the Front Desk and on the dining Tables.

Kubernetes Control Plane

The Front Desk has the responsibility for managing the entire restaurant, and ensuring that the service runs smoothly for the customers.

In Tommy’s restaurant, the Front Desk is made up of staff roles and technology consisting of: Waiters, Receptionists, Databases, and a Maitre’d. They are responsible for managing and coordinating all the activities that happen within the restaurant.

The IT Business will implement a Control Plane, analogous to a Front Desk, consisting of a Scheduler, Kube API, Controller Manager, and Etcd database. These components maintain the cluster's desired state, schedule and execute workloads, and manage overall cluster operations.

Checkpoint Click here to check in and see what you've learned so far

- Kubernetes: Kubernetes orchestrates container deployment, scaling, and management across clusters, reducing complexity with lifecycle management as the number of containers grows.

- Control Plane: This focuses on managing and controlling the cluster's operations to match a desired state.

- Worker Nodes: This is where Workloads are run, along with their corresponding Containers.

- Businesses can decide whether they prefer to host their own control plane to reduce costs and have more flexibility, or if they prefer to pay a cloud provider to host and manage it for them.

Kube API

The receptionist is the first of four Front Desk components which we will explore in more detail.

The receptionist allows customers to interact with the restaurant directly. Customers can ask questions about the menu and availability and even request specific actions and information.

In Tommy’s restaurant, the receptionist will provide coordination between staff and ensure other members of staff perform their actions to complete each order.

The Kubernetes API serves as the primary interface for interacting with the Kubernetes cluster. It exposes a set of endpoints that users can use to communicate with the cluster and perform various operations such as deploying Workloads, scaling resources or querying the cluster state. It also acts as a gatekeeper into the cluster and can restrict who can perform what actions within the Kubernetes cluster.

Etcd

Tommy realises that the store of information about the activities happening within the restaurant is essential to a service running smoothly. Whether this be the preparation of the food, any changes to the menu, interaction with the receptionist or when a customer has received their order.

The restaurant installs a database on the front desk where all of this information can be captured. The database is connected to the iPads used by the staff. The staff input important information about the status of an order which is shared to all necessary staff members through the database.

Etcd, a distributed key-value store, holds Kubernetes configuration data, cluster state, and resource information, with cluster components reporting their states to it. Ensuring Etcd's reliability through backups, upgrades, and monitoring is crucial for the integrity of a Kubernetes cluster.

Scheduler

The restaurant is taking shape and the staff are performing their jobs well, but now Tommy sees the opportunity for the restaurant to run more efficiently and make better use of the staff and tables it has available.

Tommy employs a Maitre’d to form part of the Front Desk team. The Maitre’d has the responsibility of determining where to seat customers to optimise table allocation based on the availability and capacity.

The Scheduler, part of Kubernetes' Control Plane, assigns pods to nodes based on resource availability and scheduling policies. Its optimisation affects cluster performance, complementing auto-scaling to adjust the cluster size dynamically according to workload demands.

Controller Manager

The fourth and final role of the Front Desk are the dedicated waiter(s).

A Dedicated Waiter in Tommy’s restaurant will be assigned to each customer and oversees orders from beginning to end, ensuring it is successful and creates a pleasant dining experience.

The Controller Manager efficiently executes and manages watches, continuously aligning the node's actual state with the desired state. For example, if no 'noise reduction' containers are running but one is needed, the manager ensures one is running.

Checkpoint Click here to check in and see what you've learned so far

- Kube API: This is the main interface for cluster interactions, enabling users to deploy workloads, scale resources, and query the cluster state through various endpoints.

- Etcd: Kubernetes stores essential cluster information, like its current state and resource details, in Etcd, a specialised database updated with any cluster changes, such as new Pod creation.

- Scheduler: This component efficiently allocates Pods to worker nodes, balancing workloads and optimising resource usage.

- Controller Manager: The Controller Manager coordinates cluster state tasks that are outstanding, like noise reduction on audio files, by managing resources, execution, and logging.

Worker Nodes

The tables in the dining area are not part of the front desk, but they must interact with the front desk throughout a customer's dining experience. The tables are where the food is actually cooked for the customer.

The table in the dining area is where the food is cooked in front of the customers. Tommy always valued interaction with his customers while cooking the food, and he wanted to carry this concept over into his restaurant.

Worker nodes in a Kubernetes cluster run containerised applications and manage networking for internal and external communication, easily scaling to match workload demands.

Kubelet

Whilst the table in the dining area is the location where the ingredients are cooked, the Table Chef performs the cooking and assembly of the burger and all of the other delicious meals on the menu.

The Table Chef follows Front Desk instructions to cook orders to standard, restarting any that don't meet quality expectations. The Front Desk is kept up to date of the status throughout this cooking process.

The Kubelet ensures that the containers specified in Kubernetes pods are running and healthy on its node. It is responsible for managing the lifecycle of a container, running health checks on the containers and reporting back to the Control Plane the status and condition of the node.

Checkpoint Click here to check in and see what you've learned so far

- Worker Node: Components of a Kubernetes cluster, separate from the Control Plane, executing tasks and running containers for workloads.

- Kubelet: A key component on each Worker Node, follows the Control Plane's instructions to manage containers—starting and stopping them as required. The Kubelet guarantees containers run as intended, communicating their status back to the Control Plane.

Benefits of Kubernetes

The restaurant utilising a digitised restaurant management system to coordinate staff with defined roles and responsibilities is alien to Tommy, and something he has never required when running a food truck. He asks Poppy to explain the benefits.

Self Healing

The digitised restaurant management system will monitor the state of both the tables and the orders. Should there be an issue, it can alert the relevant member of staff to take action to resolve.

An example may be if a grill stops working on a table in the Dining Area. The customers are quickly reallocated to another working table by the maitre'd.

If a Workload fails on a worker node, Kubernetes automatically detects it. The Kubelet writes to etcd that the Workload has failed, triggering the scheduler to reallocate the Workload to another healthy node.

Intelligent decision making

In addition to one-time failures, the digitised restaurant management system utilises reports from customer surveys to analyse long-term patterns. Tommy can then utilise this information to make restaurant decisions.

Tommy can now receive monthly reports of how happy customers were with their meal based on which table they were on, implementing a quality control rule that if more than 20% of customers are unhappy on a table within a one month period, then he will replace the entire table.

If a monitoring system shows a worker node as unhealthy over a longer period of time, Kubernetes may initiate Node Eviction. This involves evicting all Workloads from the problematic node and replacing it to maintain uptime.

Flexible scheduling

Another benefit is that scheduling doesn’t need to be random. You have the flexibility of allocating customers to tables in the way that is most efficient.

In Tommy’s restaurant, this is similar to a scenario where you may wish to seat different groups of customers at the same table so you don’t need a table chef for each group of customers. Or if you have a large group of customers, you can assign them to a larger table which is able to handle more customers.

With Kubernetes, you could have multiple Workloads running on the same node so that you don’t have to create a new worker node each time you have a new Workload to run. Or if you have a particularly large Workload, you need to ensure that you can run this on a node which has enough resources to run it.

Checkpoint Click here to check in and see what you've learned so far

- Self healing: Kubernetes automatically responds to failures by continuously monitoring workloads and worker nodes within the cluster.

- Intelligent decision making : Kubernetes analyses long-term patterns using monitoring reports.

- Flexible scheduling: Kubernetes allows for efficient workload scheduling, offering flexibility beyond random allocation.

Overall, a Container Orchestration system like Kubernetes offers not only automation and ease in managing multiple containers, but also flexibility and intelligent decision making. Application downtime is reduced due to Kubernetes' ability to self heal broken components as soon as a failure is detected and costs are kept to a minimum with smart allocation of workloads.

Section Recap

In this section we learned...

Kubernetes efficiently manages the deployment, scaling and operations of containers

Kubernetes self-heals, enhances flexibility and enables intelligent decision-making

It consists of a Control Plane, which maintains the cluster's desired state

And Worker Nodes, where containers assigned by the control plane are executed

Next Section

Let’s recap everything we’ve learnt about Containers, Workloads and Kubernetes...

Next Summary