Kubernetes in 2 steps w/ only local image

Image for post
Image for post

Hey,

I know this is not a very basic topic, but I believe that to learn something this complex we need to start by that I mean not just watch a bunch of online tutorials but by running it on one’s system.
So in this, we will see how to get and container and load it into a pod and deploy it into deployment and service it.

So this will in involve 2 simple steps, don’t worry if you don’t understand everything fully. There is plenty of time to learn each and every step, and I’m sure there are plenty of resources available to know that, but in this, we are only going to see 3 steps to get us started.

Before that we need to install minkube or another package for your own system, it generally comes down to your own preference, and we also have to have an image available in dockerHub or any other platform. We can deploy local photos, but it involves extra steps, so we are going to stick to using an online repository for this demo.

Let us start by creating a deployment, for now, think of a deployment as a place where you can have a bunch of pods in one place. So where are the pods you might ask? don’t worry about that as the main feature of Kubernetes is to take care of it on its own

Before starting with Kubernetes Run this command

this will tell Kubernetes to use docker as an image container

we are going to do it imperatively as declarative needs more understanding of what is happening, but the imperative way will help you get started quick

now try

You can see the pods being generated or have generated. as this may take a while

go change ImagePullPolicy to Never as mentioned in the video

Now that we have created the pod, for us to interact with the pod, we first need to create a service.
we do that by exposing the pod

now try

to get the URL of the service

now you will be redirected to the browser will serve your page

Conclusion
I am not saying this is how it is done, but this is to get your hands dirty and move on to make better declarative way and understand more of the underlying concepts.
hope I helped you to start and have fun learning more

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store