Docker and Kubernetes

Kamran Ghyan
3 min readNov 27, 2020

In the last article I’ve discussed why Kubernetes. Now I’ll explain why Docker and Kubernetes are so nice together.

first we’re gonna take a look at following diagram.

Product source code and Docker file creating image of Products

In above diagram we’ve got some products files or essentially our product service source code. We took all those files and a docker file and we fed them more or less into Docker and now with that came an image for our product service.

We can now create as many instances of this image or containers as we call them as you wish. The image is really the blueprint for how to create a post container.

Now of course we’re going to actually create an instance of this product image. There we go so we’ve got our image all created

Whenever we want to use Kubernetes we have to have a set of images that are ready to go.

Now we’ve image ready and we’re going to deploy it into Kubernetes cluster.

In the following diagram right here I’m showing three separate nodes and remember a node is a virtual machine.

Kubernetes architecture

Node is essentially a computer that’s going to run number of containers for us.

So to create a container out of image or something out of the product image, first we’ve to create a configuration file in this configuration file we’re going to list out some very explicit directions for Kubernestes is going to say please create two copies of the product image for us make containers and host them somewhere on these nodes.

Let me show in diagram

Kubernetes cluster

In order to manage these two pods Kubernestes is also going to create something called a deployment, So this deployment is going to be in charge of managing both these pods if anything ever goes wrong with these pods.

So if it crashes for some reason or if it just stops running or whatever else might possibly happen. This deployment right here is going to make sure that that pod automatically gets recreate it.

So the deployment is in charge of making sure that we’ve always got the right number of pods and that these pods are running successfully.

You can better idea from following diagram.

Kubernetes Deployments

So that is overview of Kubernetes, Now at this point this is running little long I can take a quick pause in next article will come with Kubernestes vocabulary.

--

--

Kamran Ghyan

Software Engineer, System Architecture, Cloud Architecture, AI enthusiastic