Traefik Ingress错误规则

时间:2019-03-06 05:22:14

标签: kubernetes google-kubernetes-engine traefik

我正在使用Google Cloud上的Kubernetes。我正在尝试将Traefik设置为集群的Ingress。我的代码基于官方网站文档https://docs.traefik.io/user-guide/kubernetes/,但路径前缀条的规则存在错误。

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 

在GKE控制台中,似乎部署已链接到服务和入口,但是当我尝试访问IP时,服务器返回错误502。

我也在使用静态IP

  

gcloud计算地址创建web-static-ip --global

0 个答案:

没有答案