Anthos MCI:如何在 GKE 中为 redirectToHttps 注释应用 FrontendConfig

问题描述

当我计划禁用 http 或其他词设置从 http 到 https 的重定向时遇到问题。然而,这样做通常有两种选择。

在“kind: ingress”中使用如下注解

kubernetes.io/ingress.allow-http: "false"

或者选择类似的选项

  1. 创建 FrontendConfig

  2. 将 gke 入口中的 FrontendConfig 称为

    networking.gke.io/v1beta1.FrontendConfig:“我的配置”

因此要使用它,我必须在入口内使用 apiVersion 作为

apiVersion: networking.gke.io/v1
kind: MultiClusterIngress

apiVersion: networking.k8s.io/v1
kind: Ingress

但问题是循环的,我不能在入口内使用“apiVersion:networking.gke.io/v1”,因为它不支持“FrontendConfig”,我也不能使用“apiVersion:networking.k8s.io/” v1”,因为它不支持“种类:MultiClusterIngress”

预期

前端配置

---
apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
Metadata:
  name: myfrontend
spec:
  redirectToHttps:
    enabled: true
    responseCodeName: PERMANENT_REDIRECT
  sslPolicy: "mypolicy"

入口

---
apiVersion: networking.gke.io/v1
# networking.gke.io/v1beta1
kind: MultiClusterIngress
Metadata:
  name: my-mci-ingress
  namespace: prod
  annotations:
      networking.gke.io/v1beta1.FrontendConfig: "myfrontend"
      networking.gke.io/static-ip: 99.99.9.9
spec:
  template:
    spec:
      backend:
      .........

如果有任何可能的解决方案可以在 GKE 中为 MultiClusterIngress 设置 http 重定向,需要您的建议。

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)