Kubernetes Ingress-Service update IP

7/10/2019

I have a Kubernetes Cluster running on Azure. I use the nginx-ingress to handle incoming requests. To set up the ingress I used the official guide https://kubernetes.github.io/ingress-nginx/deploy/#azure . I also created a public static IP which I want to use for the Ingress. Unfortunately, I´m not able to find the ingress service (generic-deployment.yaml). Also, my ingress is not describable.

How I installed Ingress:

$ sudo kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
...
deployment.apps/nginx-ingress-controller created

$ sudo kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml
service/ingress-nginx created

Additionally, I installed some routing configs by ingress.yaml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path:
        backend:
          serviceName: app0-service
          servicePort: 80
      - path: /app1
        backend:
          serviceName: app1-service
          servicePort: 80


$sudo kubectl apply -f ingress.yaml
ingress.extensions/myingress created

What confuses me

Unfortunately, I´m not able to find my ingress-nginx service.

$ sudo kubectl get svc
NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
app0-service   ClusterIP   10.0.28.3      <none>        80/TCP    3m48s
app1-service   ClusterIP   10.0.226.249   <none>        80/TCP    3m47s
kubernetes     ClusterIP   10.0.0.1       <none>        443/TCP   39m

But my ingress is running:

$ sudo kubectl get ingress
NAME        HOSTS   ADDRESS         PORTS   AGE
myingress   *       23.97.xxx.xxx   80      54m

In browser 23.97.xxx.xxx works partly.

1) If I proxy a domain name to 23.97.xxx.xxx, the domain in a browser will be rewritten by the IP.

2) If I try to browse directly to subroute like 23.97.xxx.xxx/app1/page1. I get every time the main page of app1.

I expected to get an IP from my ingress-service. Because I want to update this IP address by adding loadbalancerIP to spec in cloud-generic.yaml. (like https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/static-ip/static-ip-svc.yaml).

Is my IP from ingress the right one to use? And why I can´t find my ingress-service?

-- Nico Schuck
kubernetes
nginx-ingress

1 Answer

7/10/2019

Looking at service yaml at https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud-generic.yaml you can see it's get created in namespace ingress-nginx.

You should be able to get your service by running:

kubectl get service -n ingress-nginx 

You can also get all services by running kubectl get service --all-namespaces.

-- MWZ
Source: StackOverflow