DEV Community

Cover image for #046 Kubernetes - Services 6

Posted on

#046 Kubernetes - Services 6



this is part 46 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.

prepare files

this part was supposed to be an aws or azure lab , but due current situation of my country (big explosion happen due chemical products) and I don't have a visa to activate free account. So I will use an Nginx server instead .

as always all the files used are in my github repo here

GitHub logo khatibomar / DevOpsJourney

this is the repo where I will store all the codes used in our journey on

if you already have it just pull , if not clone it.
the source code usually hold the same chapter number we are in 046 so app_046 is what we are looking for.

Understand files


this is the app_046_v1.yml it's an typical deployment it use the google samples hello app. and we have service here of type clusterIp (we can use also NodePort) , this port 8080 is the default port of the hello image and the name of app is myapp-v1 and service myapp-v1 . Same for the v2 (go and take a look). What I care here about is the service because it's going to talk with the ingress.

we can see here annotations it's like javascript object , it's here to configure the nginx server , please go to the docs and read it.
we can notice it's take a path /v1 and /v2 , and port same as the service , and name same of service name.


as we discuss on the #045 when we expose our app to external ip we need Load balancer or Ingress .
Ingress it's mean different routes to same hosts , example and or app.example/test and app.example/test2
every route connect to an web service.

we are going to use the Ingress method in this lab.

minikube addons enable ingress
Enter fullscreen mode Exit fullscreen mode

first we need to enable the ingress add on inside minikube because we are going to use nginx as server for this lab.
now let's create our deployments with name of deployments-v1 and v2.

kubectl create -f app_046_v1.yml
kubectl create -f app_046_v2.yml
Enter fullscreen mode Exit fullscreen mode


kubectl get pods
Enter fullscreen mode Exit fullscreen mode

all our pods are created , now time to create our ingress service.

kubectl create -f app_046_ingress.yml
Enter fullscreen mode Exit fullscreen mode

we can see our service successfully created.

kubectl get ingress
Enter fullscreen mode Exit fullscreen mode

now we have our ingress ready

minikube ip
Enter fullscreen mode Exit fullscreen mode is our local ip , if our azure setup is online we will get a real external ip that we can access any time , anywhere , and you also can access it!

head to and the ip may vary for you so just change the ip.

we can see now we can access 2 different apps (microservices) using same ip with different routes !

Top comments (0)