Tuesday, March 6, 2018

Kubernetes? Docker? What is the difference?

From a distance, Docker and Kubernetes can appear to be similar technologies; they both help you run applications within Linux containers. If you look a little closer, you’ll find that the technologies operate at different layers of the stack, and can even be used together. 

Understanding both Docker and Kubernetes is essential if you want to build and run a modern cloud infrastructure. Let’s take a look to see how they both fit into the world of Linux containers, and how you can use them when architecting your own applications.

Containers - A Quick Intro

At their core, containers are a way of packaging software. What makes them special is that when you run a container, you know exactly how it will run - it’s predictable, repeatable and immutable. There are no unexpected errors when you move it to a new machine, or between environments. All of your application’s code, libraries, and dependencies are packed together in the container as an immutable artifact. You can think of running a container like running a virtual machine, without the overhead of spinning up an entire operating system. For this reason, bundling your application in a container vs. a virtual machine will improve startup time significantly.
The above characteristics make containers an awesome tool and essential building block in modern cloud architecture. While the industry pushes towards building microservice architectures, containers help facilitate quick elasticity and separate of concerns. And while some may not yet be building microservices, traditional monoliths can be containerized and reap some of the aforementioned benefits.
This all sounds really nice, but how do you actually build a container?

Build and Deploy Containers with Docker

Docker helps you create and deploy software within containers. It’s an open source collection of tools that help you “Build, Ship, and Run any App, Anywhere”. Yes, it really is as magic as it sounds. 
With Docker, you create a special file called a Dockerfile. Dockerfiles define a build process, which, when fed to the ‘docker build’ command, will produce an immutable docker image. You can think of this as a snapshot of your application, ready to be brought to life at any time. When you want to start it up, just use the ‘docker run’ command to run it anywhere the docker daemon is supported and running. It can be on your laptop, your production server in the cloud, or on a raspberry pi. Regardless of where your image is running, it will behave the same way. 
Docker also provides a cloud-based repository called Docker Hub. You can think of it like GitHub for Docker Images. You can use Docker Hub to create, store, and distribute the container images you build.

Manage Containers with Kubernetes

Once you’ve recovered from the excitement of spinning up your first few Docker containers, you’ll realize that something is missing. If you want to run multiple containers across multiple machines - which you’ll need to do if you’re using microservices - there is still a lot of work to do.
You need to start the right containers at the right time, figure out how they can talk to each other, handle storage considerations, and deal with failed containers or hardware. Doing all of this manually would be a nightmare. Luckily, that’s where Kubernetes comes in.
Kubernetes is an open source container orchestration platform, allowing large numbers of containers to work together in harmony, reducing operational burden. It helps with things like:
  • Running containers across many different machines
  • Scaling up or down by adding or removing containers when demand changes
  • Keeping storage consistent with multiple instances of an application
  • Distributing load between the containers
  • Launching new containers on different machines if something fails 


Wait, Doesn’t Docker do Container Management?

Kubernetes isn’t the only container management tool around. Docker also has its own native container management tool called Docker Swarm. It lets you deploy containers as Swarms that you can interact with as a single unit, with all the container management taken care of. To be clear, Kubernetes does not interact with Docker Swarm in any fashion, only the Docker engine itself.

Using Docker with Kubernetes

As previously mentioned, Docker and Kubernetes work at different levels. Under the hood, Kubernetes can integrate with the Docker engine to coordinate the scheduling and execution of Docker containers on Kubelets. The Docker engine itself is responsible for running the actual container image built by running ‘docker build’. Higher level concepts such as service-discovery, load-balancing and network policies are handled by Kubernetes as well.
When used together, both Docker and Kubernetes are great tools for developing a modern cloud architecture, but they are fundamentally different at their core. It is important to understand the high-level differences between the technologies when building your stack.
Let Containership help unravel the mysteries of cloud computing for you.

6 comments:

  1. Great article ...Thanks for your great information, the contents are quiet interesting. I will be waiting for your next post.
    Docker and Kubernetes Training

    ReplyDelete

  2. Just found your post by searching on the Google, I am Impressed and Learned Lot of new thing from your post. I am new to blogging and always try to learn new skill as I believe that blogging is the full time job for learning new things day by day.

    Best ASP.NET MVC Online Training Institute
    Best Spring Online Training Institute
    Best Devops Online Training Institute
    Best Datascience Online Training Institute
    Best Oracle Online Training Institute
    Best AWS Online Training Institute
    Best AngularJS Online Training Institute

    ReplyDelete
  3. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
    Igained more knowledge from your blog. Keep Doing..

    oracle training in chennai

    oracle training institute in chennai

    oracle training in bangalore

    oracle training in hyderabad

    oracle training

    oracle online training

    hadoop training in chennai

    hadoop training in bangalore

    ReplyDelete