Can't get traefik on kubernetes to working with external IP in a home lab

5/9/2019

I have a 3 node Kubernetes cluster running at home. I deployed traefik with helm, however, it never gets an external IP. Since this is in the private IP address space, shouldn't I expect the external IP to be something in the same address space? Am I missing something critical here?

$ kubectl describe svc traefik --namespace kube-system
Name:                     traefik
Namespace:                kube-system
Labels:                   app=traefik
                          chart=traefik-1.64.0
                          heritage=Tiller
                          release=traefik
Annotations:              <none>
Selector:                 app=traefik,release=traefik
Type:                     NodePort
IP:                       10.233.62.160
Port:                     http  80/TCP
TargetPort:               http/TCP
NodePort:                 http  31111/TCP
Endpoints:                10.233.86.47:80
Port:                     https  443/TCP
TargetPort:               httpn/TCP
NodePort:                 https  30690/TCP
Endpoints:                10.233.86.47:8880
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

$ kubectl get svc traefik --namespace kube-system -w
NAME      TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
traefik   NodePort   10.233.62.160   <none>        80:31111/TCP,443:30690/TCP   133m
-- farhany
kubernetes

3 Answers

5/9/2019

external IP works in external cloud provider platform like Google CLoud Platform.

In your case, you can access traefik service at the below url

node-host:nodeport

http://<hostname-of-worker-node>:31111
-- P Ekambaram
Source: StackOverflow

5/10/2019

Use MetalLB, to get an LB IP. More here on their site.

-- farhany
Source: StackOverflow

5/9/2019

As seen in the outputs, type of your service is NodePort. With this type no external ip is exposed. Here is the definition from official documentatin:

If you set the type field to NodePort, the Kubernetes master will allocate a port from a range specified by --service-node-port-range flag (default: 30000-32767), and each Node will proxy that port (the same port number on every Node) into your Service. That port will be reported in your Service’s .spec.ports[*].nodePort field.

If you want to reach your service from external you have to use ip address of your computer and the port that Kubernetes exposed like this:

http://IP_OF_YOUR_COMPUTER:31111

You can read this page for details.

-- Yavuz Sert
Source: StackOverflow