“Hello World” in Kubernetes — For absolute Beginners — Part 2

Vignesh Kathirkamar
3 min readJul 17, 2022

--

This is a continuation of “ “Hello World” in Kubernetes — For absolute Beginners — Part 1"

You can also find a video version here: https://www.youtube.com/watch?v=KbZOb0nzVlo

Step 3a: Creating deployment file

Now as we are clear about the Kubernetes basic architecture and have a custom build docker image let’s go ahead and create a deployment file.

We will create all files in .yaml extension which stands for “yet another markup language”. Don’t worry if you don’t know what is a “.yaml” file, consider it as a text file where most lines is of the style “key:value” pair.

Let’s create our “deployment.yaml” file. The deployment file, tells Kubernetes how to create or modify instances of the pods that hold a containerized application.

On line 9, “replicas: 2” specifies that the there will always 2 stable set of running pods

Step 3b: Creating service file

Now, since we have created our deployment let’s go on and create the service file.

A service is responsible for exposing an interface to those pods, which enables network access from either within the cluster or between external processes and the service.

Step 4: “kubectl apply”

Now, as we have all our required files, let’s use kubectl commands shown below to deploy our pods and then expose it’s service .

Go to the folder where your .yaml files reside and run the following command

kubectl apply -f deployment.yaml
kubectl apply -f service.yaml

Once the above command is finished running, open up the minikube dashboard and view it.

First you need to start up the minikube and then view it’s dashboard, following are the commands to do those

minikube start
minikube dashboard
minikube start

Once you run “minikube dashboard” you will be seeing a dashboard similar to the one below

minikube dashboard

Feel free to explore the dashboard and try to understand the terms on it.

Step5: Viewing our deployed app

Use the command “minikube service <name of your service>” to view the deployed service.

If you have followed the same service.yaml file mentioned in this article, then the name of your service would be “flask-app”.

minikube service <name of the service>
Eg:
minikube service flask-service
minikube service flask-service

Now since you know how to deploy “Hello world” using Docker, flask and Kubernetes go and try deploying a simple app like addition of numbers where users input the numbers and get the result on clicking a button

--

--

Vignesh Kathirkamar
Vignesh Kathirkamar

Written by Vignesh Kathirkamar

AI/ML Engineer || A failed Blogger || Ex Highway designer || Linkedin: https://www.linkedin.com/in/vigneshkathirkamar/

No responses yet