kubectl get ing gives no address in kubernetes ingress

0 votes

I tried configuring ingress cluster. I ran the following commands

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/provider/baremetal/service-nodeport.yaml

After that default-http-backend and nginx-ingress-controller were running:

ingress-nginx   default-http-backend-846b65fb5f-6kwvp      1/1       Running   0          23h       192.168.2.28   node1
ingress-nginx   nginx-ingress-controller-d658896cd-6m76j   1/1       Running   0          6m        192.168.2.31   node1

I tried testing ingress and I deployed the following service:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: echoserver-deploy
spec:
  replicas: 2
  selector:
    matchLabels:
      app: echo
  template:
    metadata:
      labels:
        app: echo
    spec:
      containers:
        - name: my-echo
          image: gcr.io/google_containers/echoserver:1.8
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver-svc
spec:
  selector:
    app: echo
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080

And the following ingress:

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: 8080

When I ran the command 'kubectl get ing' I received:

NAME            HOSTS          ADDRESS   PORTS     AGE
happy-ingress   happy.k8s.io             80        14m
Sep 7, 2018 in Kubernetes by lina
• 8,220 points
28,371 views

3 answers to this question.

0 votes

You can check under which IP is the cluster working:

bash-3.2$ kubectl cluster-info
Kubernetes master is running at https://192.168.1.100:8443
KubeDNS is running at https://192.168.1.100:8443/api/v1/namespaces/kube- 
system/services/kube-dns:dns/proxy

Test the ingress controller for your cluster using curl

bash-3.2$ curl http://192.168.1.100:8080
default backend - 404

In the end, you should just add the domain entry to /etc/hosts :

192.168.1.100   happy.k8s.io

Because your hostname happy.k8s.io should resolve to an actual IP address of the nginx-ingress-controller, which points to the front of your load balancer.

If you are interested in knowing more about Kubernetes, then consider taking  CKA Certification Course.

answered Sep 7, 2018 by Kalgi
• 52,350 points
0 votes
Make sure you use the service type as Load balancer to get an external IP on your ingress or matter of fact any service that you try to deploy.
answered Apr 23, 2019 by Jaimi
What if I use the service type as NodePort?
NodePort opens any one of the available port. You can also use NodePort but it might not give you an external IP though instead give a port that will be opened on all the nodes.
I find all the service types very confusing. Could you please explain how and where to use which service type? Thank you

Have a look at this thread, might give you a better clear understanding: https://www.edureka.co/community/19351/clusterip-nodeport-loadbalancer-different-from-each-other?

Have a look at this thread. I hope you get a clear understanding with it: https://www.edureka.co/community/19351/clusterip-nodeport-loadbalancer-different-from-each-other?

0 votes

 I had the same problem and I solved it by hardcoding address in ingress controller. You can do it by adding "externalIPs" parameter in spec block (in ingress yaml)

answered Apr 24, 2019 by Chris

Related Questions In Kubernetes

0 votes
1 answer

Customize the routing logic in kubernetes ingress controller

Try building your own customized image based on ...READ MORE

answered Sep 7, 2018 in Kubernetes by Kalgi
• 52,350 points
1,331 views
0 votes
1 answer

ingress port getting redirected in kubernetes

Try the following, it worked for me Changed ...READ MORE

answered Sep 10, 2018 in Kubernetes by Kalgi
• 52,350 points
822 views
0 votes
1 answer

Ingress nginx loading resource 404 in kubernetes

This is not a routing problem on ...READ MORE

answered Sep 10, 2018 in Kubernetes by Kalgi
• 52,350 points
8,142 views
0 votes
1 answer

Kubernetes nginx-ingress TLS issue

You have to create a secret named test-secret. ➜ ...READ MORE

answered Sep 11, 2018 in Kubernetes by Kalgi
• 52,350 points
1,972 views
+1 vote
1 answer
0 votes
3 answers

Nginx reverse proxy URL getting rewritten

Hey @Gopi, try your ingress probably like ...READ MORE

answered Feb 12, 2019 in Kubernetes by Kalgi
• 52,350 points
4,725 views
0 votes
1 answer

Filter source ip in kubernetes ingress in GCE

This feature currently works only with nginx. Example ...READ MORE

answered Sep 7, 2018 in Kubernetes by Kalgi
• 52,350 points
1,260 views
0 votes
2 answers

single point of entry for multiple services in kubernetes ingress

I tried having something similar too. Deployment apiVersion: extensions/v1beta1 kind: ...READ MORE

answered Sep 7, 2018 in Kubernetes by Hannah
• 18,520 points
2,695 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP