-
Created this scenario on Macbook pro:
-
create a nginx-controller using the below command.
kubectl apply -f mandatory.yaml
-
Enable ingress add-on.
kubectl apply -f cloud-generic.yaml
-
Verify the nginx-controller pod
kubectl get pods --all-namespaces -l app=ingress-nginx
- Create a file ns-dev.yaml
- Deploy the microservices using the configuration in micro-services.yaml
$ kubectl apply -f micro-services.yaml
- Create ingress.yaml to route the requests to
/hello
/banana
/apple
- Deploy
ingress rules
$ kubectl apply -f ingress.yaml
- Check the pods and ingress rule
$ kubectl get all -n dev
$ kubectl get ingress -n dev
- Append
vishnu.local.com
in/etc/hosts
127.0.0.1 localhost vishnu.local.com
- Verify the output
$ curl -kv vishnu.local.com/hello output: * Trying ::1... * TCP_NODELAY set * Connection failed * connect to ::1 port 80 failed: Connection refused * Trying 127.0.0.1... * TCP_NODELAY set * Connected to vishnu.local.com (127.0.0.1) port 80 (#0) > GET /hello HTTP/1.1 > Host: vishnu.local.com > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 < Server: nginx/1.15.9 < Date: Fri, 29 Mar 2019 20:33:41 GMT < Content-Type: application/json;charset=UTF-8 < Content-Length: 18 < Connection: keep-alive < * Connection #0 to host vishnu.local.com left intact {"status":"hello"}%