Empty ADDRESS kubernetes ingress

Solution 1:

You have to enable ingress addons by following command before creating ingress rules. You can also enable it before executing any other command

$ minikube addons enable ingress
ingress was successfully enabled

Wait until the pods are up and running. You can check by executing following command and wait for the similar output

kubectl get pods -n kube-system | grep nginx-ingress-controller

nginx-ingress-controller-5984b97644-jjng2   1/1       Running   2          1h

enter image description here For Deployment you have to specify the containerPort and for Service you have to specify http protocol.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: echoserver-deploy
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-echo
  template:
    metadata:
      labels:
        app: my-echo
    spec:
      containers:
        - name: my-echo
          image: gcr.io/kubernetes-e2e-test-images/echoserver:2.1
          ports:
          - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver-svc
spec:
  selector:
    app: my-echo
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
    name: http

For ingress rule change the port servicePort from 8080 to 80 the default http port.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: happy-ingress
  annotations:
    INGRESS.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: happy.k8s.io
    http:
      paths:
      - path: /echoserver
        backend:
          serviceName: echoserver-svc
          servicePort: 80

Now apply those files and create your pods, service and ingress rule. Wait few moment, it will take few moments to get ADDRESS for your ingress rule. enter image description here Now you can visit your service using minikube ip address but not by host name yet. For that you have to add the host and respective IP address in /etc/hosts file. So open /etc/hosts file in your favorite editor and add below line where is the actual IP of you minikube

<minikube_ip> happy.k8s.io

Now you access you service using host name. Verify be following command

curl http://happy.k8s.io/echoserver

Solution 2:

As official document say:

Because NodePort Services do not get a LoadBalancerIP assigned by definition, the NGINX Ingress controller does not update the status of Ingress objects it manages

You have deployed the NGINX Ingress controller as described in the installation guide, so it is normal for your ADDRESS was empty!

Instead, the external client must append the NodePort allocated to the ingress-nginx Service to HTTP requests.

ps. This question is not about minikube