Treafik UI - Kubernetes - Connection Refused

5/10/2018

I have installed Traefik on Kubernetes and followed allong the official tutorial. I have a cluster of 4 machines for Kubernetes.

When I run kubectl --namespace=kube-system get pods I see traefik-ingress-controller-678226159-eqseo, so all fine.

Then I executed:

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

and then ran:

echo "$(my master node ip) traefik-ui.minikube" | sudo tee -a /etc/hosts

which resulted in: http://192.168.178.31 traefik-ui.minikube in /etc/hosts

I further edited kubectl -n kube-system edit service traefik-web-ui service and changed the type to NodePort.

When I finally run $ curl http://192.168.178.31:31107 I get:

curl: (7) Failed to connect to 192.168.178.31 port 31107: Connection refused

Does anyone know, why I am getting the Connection refused?

EDIT 1:

Log from kubectl logs -f traefik-ingress-controller-68994b879-5z2xr -n kube-system:

time="2018-05-13T09:55:48Z" level=info msg="Traefik version v1.6.0 built on 2018-04-30_09:28:44PM"
time="2018-05-13T09:55:48Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/basics/#collected-data\n"
time="2018-05-13T09:55:48Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0x14ed5e50} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
time="2018-05-13T09:55:48Z" level=info msg="Preparing server traefik &{Address::8080 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0x14ed5e60} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
time="2018-05-13T09:55:48Z" level=info msg="Starting server on :80"
time="2018-05-13T09:55:48Z" level=info msg="Starting provider *kubernetes.Provider {\"Watch\":true,\"Filename\":\"\",\"Constraints\":[],\"Trace\":false,\"TemplateVersion\":0,\"DebugLogGeneratedTemplate\":false,\"Endpoint\":\"\",\"Token\":\"\",\"CertAuthFilePath\":\"\",\"DisablePassHostHeaders\":false,\"EnablePassTLSCert\":false,\"Namespaces\":null,\"LabelSelector\":\"\",\"IngressClass\":\"\"}"
time="2018-05-13T09:55:48Z" level=info msg="Starting server on :8080"
time="2018-05-13T09:55:48Z" level=info msg="ingress label selector is: \"\""
time="2018-05-13T09:55:48Z" level=info msg="Creating in-cluster Provider client"
time="2018-05-13T09:55:48Z" level=info msg="Server configuration reloaded on :80"
time="2018-05-13T09:55:48Z" level=info msg="Server configuration reloaded on :8080"
time="2018-05-13T09:55:53Z" level=info msg="Server configuration reloaded on :80"
time="2018-05-13T09:55:53Z" level=info msg="Server configuration reloaded on :8080"
time="2018-05-13T09:55:55Z" level=info msg="Server configuration reloaded on :80"
time="2018-05-13T09:55:55Z" level=info msg="Server configuration reloaded on :8080"
-- Max
kubernetes
traefik

1 Answer

5/11/2018

in https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/ui.yaml there is following ingress definition:

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-web-ui
  namespace: kube-system
spec:
  rules:
  - host: traefik-ui.minikube
    http:
      paths:
      - path: /
        backend:
          serviceName: traefik-web-ui
          servicePort: web

This mean you should access traefik-web-ui via ingress service.

If you deployed traefik as Deployment (https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-deployment.yaml), you should check the NodePort returned by kubectl describe svc traefik-ingress-service -n kube-system and use it as your url (http://traefik-ui.minikube:xxx)

(you don't have to change traefik-web-ui to NodePort)

If you used DeamonSet (https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-ds.yaml) just use http://traefik-ui.minikube.

If you would like to access traefik-web-ui directly the easiest way would be: minikube service traefik-web-ui --url

-- Maciek Sawicki
Source: StackOverflow