Dockers, Containers and Kubernetes – A Simple Explanation

Docker, Containers and Kubernetes Clearly Explained

In this short write-up, I would explain to you these important trends in IT. The interesting thing is that they are actually very simple concepts and not too tough to learn. So you after this explanation, you can decide whether to  go further.

This  actually follows from my preview explanation microservice. Read it up What are Microservices?

We’ll cover the following sub-topics in this lesson:

  1. Review of Microservices
  2. Docker and Containers
  3. Concept of Orchestration (Kubernetes)
  4. Other related Technologies
  5. Final Thoughts

1. Review of Microservices

Normally, the way we develop application is to write, the codes, add other components (database connection for example), test it, if it works, we then deploy it to the server. Then we provide users with the HTTP url to the application. And we are all done! Application built in this way, we call it monolithic, which means just one application.

The alternative is microservices. In this method, the application is broken down into several small applications. These smaller applications are called microservices. Each one represents a particular function of the original application.

For example, user registration would be it’s own application, same with checkbalance, make transfer etc (in case of banking application. The interesting thing about it is that although these application would work together, but they can also be independent of others. You can read more..

 

2. Docker and Containers

Now Docker is simply a tool used to implement microservices. Another definition is that Docker is a platform for building running and distributing containers. This means that when you break your application down into microservices, you can then use docker to create what is called docker images. An image is simply your microservice packaged together with all needed to run it: runtime, dependencies etc. Once an image is created, this image can then be distributed and can be run on any platform.

So what is a container? A container is an instance of an image. So let’s say you distribute your docker image. Then some user decides to run it. Once the image starts running, a container is created, and the application runs inside the container. The container can be killed or stopped. But that does not affect the image. You can start as many containers (instances) as you want from the same image.

Just to let you know also that each container runs on a different port.

 

3. Concept of Orchestration (Kubernetes)

So what then is Kubernetes? To understand Kubernetes, you need to understand the concept of orchestration. Lets’ say you build a system made up of dozens of microservices. These microservices has to communicate with each other, used resources, store data etc. How do all these services work together? That is what orchestration is all about. So Kubernetes just like Docker is an orchestration tool for managing microservices.

The strong point with Kubernetes in addition to being open-source is the ability to perform scaling. This means that it can create more containers or destroy containers depending on the load on the service.

Definition (in case you have a quiz): Kubernetes is a container orchestration system.

 

4. Other Related Concepts

Another concept I would like you to know is ‘Service Discovery’. So if there are so many microservices out there, how do you find them? Or let’s say a user makes a request over HTTP, how is this request routed to the appropriate microservice to handle the request? This is what service discovery is all about. Again there are tools to handles service discovery. One popular one is called Eureka.

Another concept is Continuous Integration/Continuous Deployment (CI/CD). This refers to being able to make changes in the code and deploy it automatically without any application downtime. Again, there are tools to do this: for instance Jenkins, Ansible.

Then we have Source Control (or Version Control). This is the method of tracking changes to program codes of application being developed. Some source control tools are Git and TFS.

 

5. Final Thoughts

The challenge many learners have is mixing up the tools and the concepts. I would advice you focus on learning the concepts first. Then you can think of tools used to handle it. In this short lesson we have learnt the following concepts:

  • Microservices
  • Containerization
  • Orchestration
  • Service Discovery
  • Source Control

Feel free to subscribe to my YouTube Channel for IT Tutorials.

 

More Tutorials on Microservices

One Comment on “Dockers, Containers and Kubernetes – A Simple Explanation”

Leave a Reply

Your email address will not be published. Required fields are marked *