Packaging Apps for Kubernetes
Learn how we can package apps for Kubernetes.
We'll cover the following
Kubernetes runs containers, VMs, Wasm apps, and more. However, they all have to be wrapped in Pods to run on Kubernetes.
We’ll cover Pods shortly, but for now, think of them as a thin wrapper that abstracts different types of tasks so they can run on Kubernetes. The following courier analogy might help.
Courier analogy
Couriers allow us to ship books, clothes, food, electrical items, and more, so long as we use their approved packaging and labels. Once we’ve packaged and labeled our goods, we hand them to the courier for delivery. The courier then handles the complex logistics of which planes and trucks to use, secure hand-offs to local delivery hubs, and eventual delivery to the customer. They also provide services for tracking packages, changing delivery details, and attesting successful delivery. All we have to do is package and label the goods.
Running apps on Kubernetes is similar. Kubernetes can run containers, VMs, Wasm apps and more, so long as we wrap them in Pods. Once wrapped in a Pod, we give the app to Kubernetes, and Kubernetes runs it. This includes the complex logistics of choosing appropriate nodes, joining networks, attaching volumes, and more. Kubernetes even lets us query apps and make changes.
Deployments
Consider a quick example. We write an app in our favorite language, containerize it, push it to a registry, and wrap it in a Pod. At this point, we can give the Pod to Kubernetes, and Kubernetes will run it. However, most of the time we’ll use a higher-level controller to deploy and manage Pods. To do this, we wrap the Pod inside a controller object such as a Deployment.
Don’t worry about the details yet, we’ll cover everything in a lot more depth and with lots of examples later in the course. Right now, we only need to know two things:
Apps need to be wrapped in Pods to run on Kubernetes
Pods are normally wrapped in higher-level controllers for advanced features
Let’s quickly go back to the courier analogy to help explain the role of controllers.
Most couriers offer additional services such as insurance for the goods we’re shipping, signature and photographic proof of delivery, express delivery services, and more. All of these add value to the service.
Again, Kubernetes is similar. It implements controllers that add value, such as ensuring the health of apps, automatically scaling when demand increases, and more.
The following figure shows a container wrapped in a Pod, which, in turn, is wrapped in a Deployment. Don’t worry about the YAML configuration yet, it’s just there to seed the idea.
Get hands-on with 1400+ tech skills courses.