In the previous chapter, we covered creating and managing container images, where we discussed container images, Dockerfiles, and their directives and components. We also looked at the best practices for writing a Dockerfile and building and managing efficient images. We then looked at flattening Docker images and investigated in detail distroless images to improve container security. Finally, we created a private Docker registry.
Now, we will deep dive into container orchestration. We will learn how to schedule and run containers using the most popular container orchestrator – Kubernetes.
In this chapter, we’re going to cover the following main topics:
- What is Kubernetes, and why do I need it?
- Kubernetes architecture
- Installing Kubernetes (Minikube and KinD)
- Understanding Kubernetes pods
Technical requirements
For this chapter, we assume you have Docker installed on a Linux machine running Ubuntu 18.04 Bionic LTS or later, with sudo access. You can follow Chapter 3, Containerization with Docker, formore details on how to do that.
You will also need to clone the following GitHub repository for some exercises: https://github.com/PacktPublishing/Modern-DevOps-Practices-2e.
Run the following command to clone the repository into your home directory, and cd into the ch5 directory to access the required resources:
$ git clone https://github.com/PacktPublishing/Modern-DevOps-Practices-2e.git \ modern-devops
$ cd modern-devops/ch5
As the repository contains files with placeholders, you must replace the <your_dockerhub_user> string with your actual Docker Hub user. Use the following commands to substitute the placeholders:
$ grep -rl ‘<your_dockerhub_user>’ . | xargs sed -i -e \ ‘s/<your_dockerhub_user>/<your actual docker hub user>/g’