Unable to access pods using nodeIP

0 votes

I'm new to kubernetes

I have created 2 deployments :

kubectl run nginx --image=nginx --port=80
kubectl run echoserver --image=gcr.io/google_containers/echoserver:1.4 --port=8080

I have also created their corresponding services :

kubectl expose deployment nginx --target-port=80 --type=NodePort
kubectl expose deployment echoserver --target-port=8080 --type=NodePort

My svc are :

[root@node1 kubernetes]# kubectl get svc
NAME         TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
echoserver   NodePort   <none>        8080:31250/TCP   47m
nginx        NodePort    <none>        80:32018/TCP     1h

My NodeIP address is and I can access both pods using &

Now on top of this I want to deploy an Ingress so that I can reach both pods not using 2 IPs and 2 different ports BUT 1 IP address with different paths.

So my Ingress file is :

apiVersion: extensions/v1beta1
kind: Ingress
  name: fanout-nginx-ingress
  - http:
      - path: /nginx
          serviceName: nginx
          servicePort: 80
      - path: /echo
          serviceName: echoserver
          servicePort: 8080

This yields :

[root@node1 kubernetes]# kubectl describe  ing fanout-nginx-ingress
Name:             fanout-nginx-ingress
Namespace:        development
Default backend:  default-http-backend:80 (<none>)
  Host  Path  Backends
  ----  ----  --------
        /nginx   nginx:80 (<none>)
        /echo    echoserver:8080 (<none>)
Events:  <none>

Now when I try accessing the Pods using the NodeIP address (, I get nothing.

Is there something I have missed?

Sep 7, 2018 in Kubernetes by lina
• 8,220 points

1 answer to this question.

0 votes

Your kubernetes cluster is missing the ingress controller. Set up an ingress controller. You can use either GCE or nginx for this.

The ingress controller consists of several components that you create during installation. Here is installation part from Nginx Ingress documentation:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/namespace.yaml              | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/default-backend.yaml        | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/configmap.yaml              | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/tcp-services-configmap.yaml | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/udp-services-configmap.yaml | kubectl apply -f -

If you have RBAC authorization configured in your cluster:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/rbac.yaml      | kubectl apply -f -
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/with-rbac.yaml | kubectl apply -f -

If no RBAC configured:

curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/without-rbac.yaml | kubectl apply -f -

In case you create cluster from scratch:

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

Verify your installation:

kubectl get pods --all-namespaces -l app=ingress-nginx --watch

You should see something like:

NAMESPACE       NAME                                       READY     STATUS    RESTARTS   AGE
ingress-nginx   nginx-ingress-controller-699cdf846-nj2rw   1/1       Running   0          1h

Check available services and their parameters:

kubectl get services --all-namespaces
answered Sep 7, 2018 by Kalgi
• 52,370 points

Related Questions In Kubernetes

0 votes
1 answer

Is it possible to access GCP resources using api without a user interaction.?

yes that's totally possible. You'd have to create ...READ MORE

answered Sep 19, 2018 in Kubernetes by Kalgi
• 52,370 points
0 votes
1 answer

unable to start Kubernetes due to so many open files in system

You can try the following steps: You can ...READ MORE

answered May 1, 2018 in Kubernetes by shubham
• 7,320 points
0 votes
1 answer

Is possible to have same k8s service for multiple pods?

Reserve a static IP and then assign ...READ MORE

answered Jul 20, 2018 in Kubernetes by Kalgi
• 52,370 points
0 votes
1 answer

deleting pods using kubernetes replication controller

The pods which are managed by ReplicationController ...READ MORE

answered Jul 24, 2018 in Kubernetes by DareDev
• 6,890 points
+1 vote
1 answer
0 votes
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,370 points
+1 vote
1 answer

Unable to access kubernetes dashboard

You’re trying to access a private IP. ...READ MORE

answered Aug 27, 2018 in Kubernetes by Kalgi
• 52,370 points
0 votes
2 answers

Deny access to some specific paths while using kubernetes ingress

Try to create two Ingresses first by default ...READ MORE

answered Sep 21, 2018 in Kubernetes by Nilesh
• 7,040 points