External IP not working with Minikube Kubernetes

0 votes

I'm fairly new to kubernetes and have deployed my kubernetes cluster using minkube on an ubuntu machine(16.04). For some reason my external IP is not resolving.

In the services overview of the dashboard i have this

    my-nginx | run: my-nginx | 10.0.0.11 | my-nginx:80 TCP my-nginx:32431 | TCP 192.168.42.71:80 

If I curl the http://192.168.42.165:32431 I do get the nginx page.

Service config;

    # Please edit the object below. Lines beginning with a '#' will be ignored,
    # and an empty file will abort the edit. If an error occurs         while saving this file will be
    # reopened with the relevant failures.
    #
    apiVersion: v1
    kind: Service
    metadata:
      creationTimestamp: 2016-09-23T12:11:13Z
      labels:
        run: my-nginx
      name: my-nginx
      namespace: default
      resourceVersion: "4220"
      selfLink: /api/v1/namespaces/default/services/my-nginx
      uid: d24b617b-8186-11e6-a25b-9ed0bca2797a
    spec:
      clusterIP: 10.0.0.11
      deprecatedPublicIPs:
      - 192.168.42.71
      externalIPs:
      - 192.168.42.71
      ports:
      - nodePort: 32431
        port: 80
        protocol: TCP
        targetPort: 80
      selector:
        run: my-nginx
      sessionAffinity: None
      type: LoadBalancer
    status:
      loadBalancer: {}

Parts of ifconfig:

    virbr0    Link encap:Ethernet  HWaddr fe:54:00:37:8f:41  
              inet addr:192.168.122.1  Bcast:192.168.122.255          Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:4895 errors:0 dropped:0 overruns:0 frame:0
              TX packets:8804 errors:0 dropped:0 overruns:0         carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:303527 (303.5 KB)  TX bytes:12601315 (12.6         MB)

    virbr1    Link encap:Ethernet  HWaddr fe:54:00:9a:39:74  
              inet addr:192.168.42.1  Bcast:192.168.42.255          Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:7462 errors:0 dropped:0 overruns:0 frame:0
              TX packets:12176 errors:0 dropped:0 overruns:0         carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:3357881 (3.3 MB)  TX bytes:88555007 (88.5 MB)


    vnet0     Link encap:Ethernet  HWaddr fe:54:00:37:8f:41  
              inet6 addr: fe80::fc54:ff:fe37:8f41/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:4895 errors:0 dropped:0 overruns:0 frame:0
              TX packets:21173 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:372057 (372.0 KB)  TX bytes:13248977 (13.2 MB)

    vnet1     Link encap:Ethernet  HWaddr fe:54:00:9a:39:74  
              inet addr:192.168.23.1  Bcast:0.0.0.0          Mask:255.255.255.255
              inet6 addr: fe80::fc54:ff:fe9a:3974/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:7462 errors:0 dropped:0 overruns:0 frame:0
              TX packets:81072 errors:0 dropped:0 overruns:0         carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:3462349 (3.4 MB)  TX bytes:92936270 (92.9 MB)

What am I doing wrong here?

Jan 24 in Kubernetes by Atul
• 10,240 points
242 views

1 answer to this question.

0 votes

You can use an ingress controller on minkube for load balancing. Read more here  blog.

So, launch a traefik based ingress controller:

$ kubectl create -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik.yaml

Once it successfully runs create an Ingress like this and route traffic according to the hostname:

$ cat ingress.yml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 name: my-nginx-ingress
spec:
 rules:
  - host: my-nginx.192.168.99.100.xip.io
    http:
     paths:
      - path: /
        backend:
         serviceName: my-nginx
         servicePort: 80
$ kubectl create -f ingress.yml
ingress "my-nginx-ingress" created

nginx service is exposed on this URL:

http://my-nginx.192.168.99.100.xip.io/

Note:

answered Jan 24 by DareDev
• 6,810 points

Related Questions In Kubernetes

0 votes
2 answers

DNS does not resolve with NGINX in Kubernetes

adding to @kalgi's answer Using just the hostname ...READ MORE

answered Aug 30, 2018 in Kubernetes by Nilesh
• 6,900 points
351 views
0 votes
2 answers

kubernetes service external ip pending

This question is very similar to this. READ MORE

answered Oct 8, 2018 in Kubernetes by Nilesh
• 6,900 points
156 views
0 votes
2 answers

kubernetes service external ip pending

If you are not using GCE or ...READ MORE

answered Aug 31, 2018 in Kubernetes by Nilesh
• 6,900 points
2,496 views
0 votes
2 answers

Kubernetes(GKE) cronjob not working

Adding to @Kalgi's answer I think you ...READ MORE

answered Sep 19, 2018 in Kubernetes by Nilesh
• 6,900 points
479 views
0 votes
1 answer
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 37,320 points
47 views
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
1,081 views
+1 vote
1 answer

--image-pull-policy not working in kubernetes

Kubernetes does not automatically update the pods ...READ MORE

answered Dec 6, 2018 in Kubernetes by DareDev
• 6,810 points
551 views
0 votes
1 answer