#046 Kubernetes - Services 6
Tags: kubernetes, devops, tutorial
Published: 2020-08-06 23:56:36

# Introduction
![intro](https://media1.tenor.com/images/f15057a41413c960db1f328ca5a732e3/tenor.gif?itemid=6203225)

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 OmarElKhatibCS/DevOpsJourney no-readme %} 
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
![v1](https://dev-to-uploads.s3.amazonaws.com/i/dzmopib2uf9r1v3agvq8.png)

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.
![ing](https://dev-to-uploads.s3.amazonaws.com/i/6fqnaoordlzygebcl4z9.png)

we can see here annotations it's like javascript object , it's here to configure the nginx server , please go to the [docs](https://kubernetes.github.io/ingress-nginx/examples/rewrite/) 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.
***

# Lab
![mad](https://media1.tenor.com/images/4800838e793768298c7d6132734abca4/tenor.gif?itemid=11957205)
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 test.app.example and test2.app.example 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.
![Ingress](https://dev-to-uploads.s3.amazonaws.com/i/rdwzl532t8vh3d9hbxit.png)
```bash
minikube addons enable ingress
```
first we need to enable the ingress add on inside minikube because we are going to use nginx as server for this lab.
![create](https://dev-to-uploads.s3.amazonaws.com/i/e48gzv0gi2ennemgd7xi.png)
now let's create our deployments with name of deployments-v1 and v2.
```bash
kubectl create -f app_046_v1.yml
kubectl create -f app_046_v2.yml
```
![pods](https://dev-to-uploads.s3.amazonaws.com/i/0ralfeff32ei21foalow.png)
```bash
kubectl get pods
```
all our pods are created , now time to create our ingress service.
![ingress](https://dev-to-uploads.s3.amazonaws.com/i/rkfuletjoyu90ydin9jq.png)
```bash
kubectl create -f app_046_ingress.yml
```
we can see our service successfully created.
![geting](https://dev-to-uploads.s3.amazonaws.com/i/u9c2fnd2wx66upw3weyo.png)
```bash
kubectl get ingress
```
now we have our ingress ready
![ip](https://dev-to-uploads.s3.amazonaws.com/i/d2e3ply2sc03ll82iiql.png)
```bash
minikube ip
```
192.168.99.100 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!

![services](https://dev-to-uploads.s3.amazonaws.com/i/9qes7vvlvohhi497afsj.png)
head to [192.168.99.100/v1](192.168.99.100/v1) and [192.168.99.100/v2](192.168.99.100/v2) 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 !