As organizations attempt to keep costs low and want to make applications not only easier to deploy but easier to manage, Docker and Kubernetes are at the forefront of their mind. It’s not only because they’re popular, but because there’s a legitimate use case to start implementing cloud-native patterns. For example; Instead of deploying applications to VMs and managing the scale yourself, there are orchestration systems that can do it for you.
Once you architect and understand the use case for why you’d want to use Docker and Kubernetes, the question then becomes where do I start?
In this blog post, you’ll learn about what Docker is, what Kubernetes is, and which one you should learn first.
What Is Docker
Docker has many use cases, but the core of it is a way to take your application and turn it into a bite-sized version to be deployed anywhere. When you think about applications, there’s typically some code base that’s running “somewhere”. That “somewhere” can be a virtual machine or a cloud instance, for example. Instead of having to take that code base and deploy it to a virtual machine, you can package up the codebase to be used anywhere. In the cloud, on-prem, or even on your local machine. Docker is all about making an application portable.
Think about Docker, or for that matter any container engine (containerd, CRI-O, etc.) like a car engine. A car engine by itself, connected to the right components and with the right fuel, can start right up. It can work, but it can’t actually go anywhere. The engine is sort of stuck in place.
The core problem with Docker by itself is that it’s missing some key features. Because containers are meant to be ephemeral, they really aren’t meant to just run by themselves. There need to be replicas (copies), self-healing, high availability, and a lot more to keep the application stable. When you run Docker containers, you’re only running one container, which means it’s a single point of failure.
That’s where orchestration (Kubernetes) comes into play.
What Is Kubernetes
Think about Kubernetes like the car’s wheels and body. You have the engine, the car starts, it’s working, but now it needs to move around. It needs to move from point A to point B. Maybe the car needs to store one person or a bunch of people (think about if people in a car are multiple applications).
Kubernetes is the orchestrator. It tells containers what they should be doing and how they should be doing it. Without an orchestrator, containers can run, but they can’t scale. They really can’t be managed to the length that’s needed for a production-level environment. Kubernetes keeps the containers running and managed in an almost hands-off fashion.
Out of the box, you get a ton of amazing capabilities including:
- Self-healing
- High availability
- Auto-scaling
- Network management
- And a lot more
Which Should You Learn First
There’s a debate more or less that talks about should i learn docker before kubernetes, and that’s true, but the debate around that isn’t that you should learn Docker first. The debate is that you should learn a containerization engine first. Docker has many use-cases, and one of them is a containerization engine. However, there are several containerization engines out there including:
- Rkt
- runC
- containerd
- CRI-O
- Windows Containers on Hyper-V
- LXC
Although all container engines work differently, they all have one goal; to run multiple, isolated instances of an application on the same OS kernel. The isolated instances are containers. Those containers run in a virtualized way on top of the operating system (not to get confused with system-level virtualization like VMWare’s ESXi). Containers are an environment that runs on an operating system, but at the same time is completely separate from the operating system.
When it comes to learning Docker or Kubernetes first and you ask yourself do I need to learn Docker before Kubernetes? The answer is that you should instead learn about containerization engines.
How To Learn Docker and Kubernetes
Now that you know what containerization and orchestration are, you may be thinking to yourself what’s the best way to learn docker and kubernetes? The answer is closer than you think; right on your local computer! In one of CloudTruths other Kubernetes blog posts, you learn how to set up a minikube environment which you can find here. Minikube is one way that you can run Kubernetes locally on your laptop or desktop.
If you want to get creative, you can pick up a couple of Rasberry Pi’s and run something called k3s, which is a lightweight version of Kubernetes that’s popular on ARM and edge devices.
Another local and great option that a lot of people use is Docker Desktop. Docker Desktop can be installed on both Windows and macOS and it allows you to create a local Kubernetes cluster that’s managed by Docker Desktop.
If you don’t want to install Kubernetes at all, anywhere, you can use the Kubernetes playground Play With Kubernetes, which is a fully managed solution right in your web browser.
Real-World Kubernetes Cluster
Although learning Docker and Kubernetes in test environments is great, at some point you’re going to need to know how it looks in production. Otherwise, it’s going to be difficult to get Kubernetes up and running for work purposes.
If you’d like to set up a Kubernetes cluster in AWS in a fully-automated fashion, check out this blog post from CloudTruth about utilizing Terraform to create a Kubernetes cluster.
Our bite-sized newsletter with DevSecOps industry tips and security alerts to increase pipeline velocity and system security.