As we know that Kubernetes (K8s) is a container orchestration tool and Docker helps to create a container that is managed by us using Kubernetes. Docker containers are used to package and ship the app. But as we already know that Kubernetes (K8s) supports multiple container runtimes and one of them is Docker. And, Docker is one of the most popular container tools out there. Docker made container technology popular in the first place. It also caused a need for orchestration tools like Kubernetes and others.
So, let’s understand Docker:
Docker Engine comes with three components. We have a Docker server then we have Docker API (to interact with the Docker server) and Docker CLI to execute docker command against the server. Docker server itself has a couple of components and features in it and that is:
- Container Runtime: It is responsible for starting and stopping the containers or basically managing the whole lifecycle.
- Volumes: It is for persisting data in Docker.
- Network: It allows attaching Docker containers to other networks and components.
- Build Image: It allows you to build your custom image or update the existing image and then use them.
What do Kubernetes need to run containers?
In all the components mentioned above, the only part Kubernetes needs in order to run the containers inside the cluster is the Container Runtime of Docker. K8s doesn’t need all of those features that docker offers either because it has its own features for example Kubernetes CLI, Kubernetes Volumes, Kubernetes CLI, etc.
What was that news “Kubernetes dropping Docker support”?
Some time ago in the year 2020, there was news that Kubernetes dropping Docker Support. Let’s understand this, in Kubernetes to talk to any Docker components mentioned above, it needs to interact with Docker first. For this interaction with Docker, Kubernetes uses “dockershim”. As we discussed in the above paragraph K8s needs only Container Runtime.
So, the code in the Kubernetes that talks to Docker (dockershim) are actually what Kubernetes deprecating.
It is logical not to deploy the whole Docker in the K8s instead just have the Container Runtime component so that containers can run in a cluster. This will benefit in saving the resource such RAM and storage because the installation is much smaller. It will also reduce the security risk because the less component you have the less security risk you are exposed to.
Answering the main question.
Yes, Kubernetes can run without Docker, and here is the explanation:
The Container Runtime that docker uses is containerd. Docker has extracted it from its Daemon so that it can be deployed as a standalone container runtime and used in the Kubernetes cluster. Now contained is a separate project and developed & maintained by CNCF. So, we can use containerd in a Kubernetes cluster instead of Docker. In fact, containerd is already being used in major cloud platforms in the K8s cluster, for example, AWS EKS and GCP’s GKE, all use containerd already as the container runtime.
Containerd is a mature and popular container runtime used in the Kubernetes cluster. Using containerd will make much sense as it will reduce the overall load and makes the K8s much efficient. Another container runtime is cri-o which is used by OpenShift.