GKE Ambassador http -> https 重定向,健康检查问题

GKE Ambassador http -> https redirect, health check issues

我正在学习本教程 https://www.getambassador.io/docs/latest/topics/running/ambassador-with-gke/,但我在使用 http -> https 重定向时遇到严重问题。

Host 中的

insecure.action: Redirect 应该是 Route

另外需要创建自定义健康检查:

kind: BackendConfig
metadata:
  name: my-backendconfig
spec:
  healthCheck:
    checkIntervalSec: 10
    timeoutSec: 10
    healthyThreshold: 2
    unhealthyThreshold: 2
    type: HTTP
    requestPath: /ambassador/v0/check_ready
    port: 8080

并添加到 ambassador.yaml

kind: Service
metadata:
  name: ambassador
  annotations:
    cloud.google.com/backend-config: '{"ports": {"8080":"my-backendconfig"}}'
spec:
  type: NodePort
  ports:
    - name: http
      port: 8080
      targetPort: 8080
  selector:
    service: ambassador

Ingress 应该禁用 http:

kind: Ingress
metadata:
  name: basic-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "myip"
    kubernetes.io/ingress.allow-http: "false"
spec:
  tls:
    - secretName: my-self-managed-cert
  backend:
    serviceName: ambassador
    servicePort: 8080

这将只创建完美运行的 HTTPS LB,现在我们需要 http -> https 重定向。

只需转到负载平衡屏幕并再创建 1 个负载平衡器(无后端),它只会将 http 重定向到 https。