Search code examples
kubernetestraefiktraefik-ingress

Traefik ingress controller throws error 503 Service Unavailable


I expose my nginx service through traefik ingress controller. Unfortunately, it results with 503 error.

$ kubectl create deployment nginx --image=nginx
$ kubectl expose deployment nginx --port=80

My traefik ingress configuration following this documentation.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: example
  annotations:
    kubernetes.io/ingress.class: traefik
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: nginx
          servicePort: http

Solution

  • It turned out that, I had to change servicePort: http to servicePort: 80 and this fixed the problem.

    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: example
      annotations:
        kubernetes.io/ingress.class: traefik
    spec:
      rules:
      - host: example.com
        http:
          paths:
          - path: /
            backend:
              serviceName: nginx
              servicePort: 80