Traefik Ingress bad rule

3/6/2019

I am working with Kubernetes on Google Cloud. I am trying to set Traefik as Ingress for the cluster. I'm based the code on the official site docs https://docs.traefik.io/user-guide/kubernetes/ but I have an error with the rule for Path Prefix Strip.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: auth-api
  labels:
    app: auth-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: auth-api
  template:
    metadata:
      labels:
        app: auth-api
        version: v0.0.1
    spec:
      containers:
      - name: auth-api
        image: gcr.io/r10c-dev/auth-api:v0.1
        ports:
        - containerPort: 3000
        env:
        - name: AMQP_SERVICE
          value: broker:5672
        - name: CACHE_SERVICE
          value: session-cache
---
apiVersion: v1
kind: Service
metadata:
  name: auth-api
spec:
  ports:
  - name: http
    targetPort: 80
    port: 3000
  type: NodePort
  selector:
    app: auth-api
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: main-ingress
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.frontend.rule.type: PathPrefixStrip
    kubernetes.io/ingress.global-static-ip-name: "web-static-ip"
spec:
  rules:
  - http:
      paths:
      - path: /auth
        backend:
          serviceName: auth-api
          servicePort: http 

In the GKE console it seems the deployment is linked to the service and the ingress, but when I try to access the IP, the server returns and error 502.

Also I am using and static IP

gcloud compute addresses create web-static-ip --global

-- Herber230
google-kubernetes-engine
kubernetes
traefik

0 Answers