Let's Explore Kubernetes:

Containers

Learning Objectives

Understand the steps towards containerisation and why it benefits businesses

Determine when to utilise custom, community or vendor built resources exploring cost vs value

Understand grouping application components together in a pod simplifies management at scale

Introduction

Let’s explore how Poppy standardises the kitchen activities so that meals can be prepared at scale.

In order for the restaurant analogies to become “real” in the coming sections, we will perform comparisons with an IT business which has an application applying various audio effects to a file, such as reducing background noise or boosting the volume.

Whilst the audio effect code is functional on their own computers with the required system tools and libraries, sharing it online poses a challenge as other computers may lack these necessary tools and settings. Let's explore the process used to resolve this problem.

In this section:

Dockerfiles

Tommy writes instructions in a recipe for how the prep chefs will combine the ingredients for his burger patty, including any kitchen equipment or utensils needed to make this work in any kitchen.

The detailed recipe for Tommy’s secret patty is simple, but has been perfected by Tommy over time with his many years experience in the catering industry. The recipe does not just include the ingredients, but the correct steps and precise quantities of the ingredients which provides a unique and replicable Patty.

A Dockerfile, like a detailed recipe, defines how to bundle code, dependencies, configurations, and commands for universal execution.

For example, we can package a 'noise reduction' effect by including an audio cleaner to prepare the input audio file, followed by the commands it needs to execute the effect in the Dockerfile.

Container Images

Once the Prep Chef receives the detailed recipe from Tommy, they can begin to construct the Patty as per the instructions.

Any Prep Chef can now follow the detailed recipe steps to turn basic ingredients into Tommy’s famous patty.

A container image packages code, libraries, tools, and settings for consistent execution across environments. The Dockerfile provides the instructions, the container image is the result of actioning these instructions.

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

- Dockerfile: This is used by developers to provide the instructions of how to combine their code with any dependencies it needs to run in any environment

- Container image: A Dockerfile is used to build a Container image, which is an executable package that can then be used to run your code on any computer.

- Container images are designed to be portable and can be easily shared and distributed, making it easier to deploy and manage code in different environments.

Community Images

When Tommy first started his food truck, he made his own burger buns. This was time consuming and initial feedback didn’t meet Tommy’s high standards.

Tommy decided to use a community bakery recipe for his burger buns, whose recipe has been evolved and improved through the family for generations.

A community bakery provides Tommy with a recipe for the burger buns. Tommy had little experience of baking buns, and therefore utilised the experience of others to enhance his Famous Burger product. Tommy has chosen to customise the burger bun by toasting the inside to add texture.

A community image is a type of container image, created and shared by the open source community. For example, if your IT business lacks in-depth front-end expertise, you could use a community image to set up a webpage for your application, which can then be tailored to fit your brand.

Vendor Images

Tommy needs a great tasting cheese to add the next layer of flavour to his famous burger, and he purchases this directly from Cheese Corp.

Cheese is not an ingredient Tommy or his prep chefs would attempt to make themselves, and therefore Tommy purchases this directly from a large high quality supplier.

A vendor image is a container image sold by a specific provider, potentially including proprietary software or licensed component and may have associated fees. For example, your IT Business may purchase a vendor image from a reputable company offering a database for use with your audio effects application.

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

- Community images: These are one type of container image that are typically open-source and free to use. Developers use them as a starting point and then adapt it to their needs.

- Vendor images: These are another type of container image developers use as they are reliable, up-to-date, and often created by experienced developers.

Image Versioning

Tommy’s patty does not remain static, and he continually looks to improve the detailed recipe over time based on feedback. Tommy will iterate and publish his new recipe every month. At this point, the prep chefs will use the most recent detailed recipe which has been published.

Versioning provides engineers with a method of rolling out changes and keeping the product standardised to any developer who is consuming it. In addition, you can determine what changed from the prior version, and gain the ability to rollback to a previous state if required.

For example, our IT Business iterates their audio effects application from the initial version, to upgrade the Audio Cleaner, and iterate to a more streamlined run command. However, the upgrade of the audio cleaner causes the application to break and so they safely and quickly rollback to the initial version to minimise disruption to their customers.

Image Registry

Tommy now has a challenge. In his Food Truck, only he needed access to his patties. With the new restaurant and the standardised practices, he has multiple prep chefs, all who need to be able to store and access the famous patties.

Tommy and Poppy install a new fridge, where the patties can be stored and be accessible to everyone in the kitchen.

An image registry is used by developers to upload, store and share container images.

For example, the IT Business has developers work on a number of audio effect custom images, which are all stored within the image registry.

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

- Image versioning: This is used to track changes and releases within a particular container image, vital to ensure developers and consumers know which version they are using.

- Image registry: Developers store and share versions of container images in a registry, ready to distribute to different environments.

- Businesses can choose whether they prefer to host their own image registry to reduce costs, or pay for a managed registry which requires no maintenance.

Containers

Now the prep chefs have completed their creation of Tommy’s patty, there are further steps to be taken before the paying customers can consume the burger.

In the dining area, Tommy has dedicated chefs responsible for cooking the patty, and turning it into a delicious burger.

A container is executable software in which application code is packaged along with its libraries and dependencies, so that the code can be run anywhere. The process of packaging code along with its dependencies in this way is called Containerisation.

Pods

The final step is to assemble the elements which will create a finished product, and what the customers recognise as Tommy’s famous burger.

The dedicated table chef is sent all of the burger components to the table. Their job is to then cook and assemble the items in a specific order for the customer to consume.

Having the components grouped into a burger pod means that the burger can be cooked and assembled at any table by any chef.

A Pod is a group of one or more containers with shared storage and network resources and a specification for how to run the containers.

For example, the IT Business chooses to group a front-end community image, audio database vendor image and their noise reduction effect custom image within a single pod.

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

- Containers: A container is executable software in which application code is packaged along with its libraries and dependencies, so that the code can be run anywhere.

- Pods: Multiple images and image types can be used to form a complete application. The executable version of these images, Containers, are grouped together in a pod so the entire application can be deployed in one go.

Section Recap

In this section we learned...

A Dockerfile is a set of instructions used to build code with any needed dependencies

A Container Image can be built from a Dockerfile

A Container is a running instance of a Container Image

The difference between a community and vendor image

A Pod is a collection of containers

Next Section

Before we are able to deploy our containerised application, we need to find a standardised way to handle requests made to the code using Workloads.

Next Workloads