7
votes

I've been trying to use Traefik as an Ingress Controller on Google Cloud's container engine.

I got my http deployment/service up and running (when I exposed it with a normal LoadBalancer, it was answering fine).

I then removed the LoadBalancer, and followed this tutorial: https://docs.traefik.io/user-guide/kubernetes/

So I got a new traefik-ingress-controller deployment and service, and an ingress for traefik's ui which I can access through the kubectl proxy.

I then create my ingress for my http service, but here comes my issue: I can't find a way to expose that externally.

I want it to be accessible by anybody via an external IP.

What am I missing?

Here is the output of kubectl get --export all:

NAME                                            READY     STATUS    RESTARTS   AGE
po/mywebservice-3818647231-gr3z9                1/1       Running   0          23h
po/mywebservice-3818647231-rn4fw                1/1       Running   0          1h
po/traefik-ingress-controller-957212644-28dx6   1/1       Running   0          1h

NAME                             CLUSTER-IP      EXTERNAL-IP   PORT(S)                       AGE
svc/mywebservice                 10.51.254.147   <none>        80/TCP                        1d
svc/kubernetes                   10.51.240.1     <none>        443/TCP                       1d
svc/traefik-ingress-controller   10.51.248.165   <nodes>       80:31447/TCP,8080:32481/TCP   25m
svc/traefik-web-ui               10.51.248.65    <none>        80/TCP                        3h

NAME                                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deploy/mywebservice                 2         2         2            2           1d
deploy/traefik-ingress-controller   1         1         1            1           3h

NAME                                      DESIRED   CURRENT   READY     AGE
rs/mywebservice-3818647231                2         2         2         23h
rs/traefik-ingress-controller-957212644   1         1         1         3h
1
You seem to have set up your Traefik Ingress controller Service with NodePorts, so it looks like you should be able to hit any node on port 31447. Alternatively, you could expose the Service through a LoadBalancer and route traffic through a single, public IP address.Timo Reimann
I'm having the same issue. Even trying curl nodeIP:nodePort doesn't return a response. Did you find a fix?brocknz

1 Answers

3
votes

You need to expose the Traefik service. Set the service spec type to LoadBalancer. Try the below service file that i've used previously:

apiVersion: v1
kind: Service
metadata:
  name: traefik
spec:
  type: LoadBalancer
  selector:
    app: traefik
    tier: proxy
  ports:
  - port: 80
    targetPort: 80