Docker vs Kubernetes, which should I use?

Ok before going any further with this blog, I have to confess something. The title is a bit catfishy but it’s a question I see a lot online so hopefully I will be able to answer it for anyone who has thought about it.

Let me start by initially definin…


This content originally appeared on DEV Community and was authored by Kapil Pau

Ok before going any further with this blog, I have to confess something. The title is a bit catfishy but it's a question I see a lot online so hopefully I will be able to answer it for anyone who has thought about it.

Let me start by initially defining what they both are.

Docker

Docker

Docker is a type of containerisation technology which allows for standardisation of packaging and shipping of products. Containers, as with Virtual Machines, run a virtual computer within your computer, however, unlike VMs, which run in parallel with the host OS and isolate resources, containers run within the host OS and are therefore much smaller, lightweight and quicker to spin up.

As with a traditional VM, containers are spun up using an image and that image contains the OS and the applications and libraries required for the container to perform whatever task is needed. Images are created using Dockerfiles, which contain a number of steps for the Docker engine to complete in order to build the image.

Docker images are typically in the 100s of MB in size and are stored in registries. Registries can be public or private, depending on the sensitivity of the images, and can be self-hosted or 3rd party hosted.

Kube

Kubernetes

Kubernetes is the industry standard container orchestration system, this is where you'll start to work out why the title is catfishy. A container orchestration tool manages the deployment, networking, availability and scaling on containers and services.

Kubernetes, often referred to as kube or k8s, is a service every cloud provider provides, with some providing their own custom Kubernetes services, like Google Kubernetes Engine (GKE) or RedHat's OpenShift Container Platform (OCP).

Kubernetes allows users to decoratively deploy their applications by telling Kubernetes what they want and letting the engine handle the deployment, maintenance and upgrade. This is done through the creation of a YAML representation of resources. The resources can be for deployment of containers, network and DNS management or auto-scalers for their deployments.

Decisions

Which should I use?

The key aspect at the heart of this question is that it's a false dilemma, it's not necessarily a question of "or", because one is fundamentally dependant upon the other. Kubernetes is a tool for augmenting containers, of which Docker is the industry standard. You can have Docker without Kubernetes, but not the other way round.

There are lots of use-cases where Docker will do the job needed, and Kubernetes is over-kill. A Kubernetes cluster requires as least two computers, or nodes, to run and, generally, requires more maintenance than a normal server. If you don't have multiple microservices which need inter-connectivity and only want one instance of your container running, then running containers natively in Docker will suffice. Using the --restart flag when starting the container will achieve the same results as a Kubernetes cluster.

On the flip side, if you are running a number of microservices, with a service mesh, and require high availability and firewalls, then Kubernetes will simplify this and require very little infrastructure knowledge. The number of required nodes for a Kubernetes cluster means that they will cost more than just using Docker natively, and if you want someone to manage the infrastructure for you, it will drive the cost up even more.

tl;dr

If you have a large, multi-microservice, production application, I'd advise Kubernetes.

If you are only using one or two containers, with limited communication between them, you should be fine with native Docker.


This content originally appeared on DEV Community and was authored by Kapil Pau


Print Share Comment Cite Upload Translate Updates
APA

Kapil Pau | Sciencx (2021-04-27T19:34:54+00:00) Docker vs Kubernetes, which should I use?. Retrieved from https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/

MLA
" » Docker vs Kubernetes, which should I use?." Kapil Pau | Sciencx - Tuesday April 27, 2021, https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/
HARVARD
Kapil Pau | Sciencx Tuesday April 27, 2021 » Docker vs Kubernetes, which should I use?., viewed ,<https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/>
VANCOUVER
Kapil Pau | Sciencx - » Docker vs Kubernetes, which should I use?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/
CHICAGO
" » Docker vs Kubernetes, which should I use?." Kapil Pau | Sciencx - Accessed . https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/
IEEE
" » Docker vs Kubernetes, which should I use?." Kapil Pau | Sciencx [Online]. Available: https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/. [Accessed: ]
rf:citation
» Docker vs Kubernetes, which should I use? | Kapil Pau | Sciencx | https://www.scien.cx/2021/04/27/docker-vs-kubernetes-which-should-i-use/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.