GKE入口Https重定向-FrontendConfig无法识别 [英] GKE ingress Https Redirect - FrontendConfig not recognized

查看:85
本文介绍了GKE入口Https重定向-FrontendConfig无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我同时具有Http和Https的GKE入口.我想将流量从端口80重定向到端口443.我找到了这个: https://github.com/kubernetes/ingress-gce/issues/1075这让它: https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#https_redirect .

I have an GKE ingress with both Http and Https. I want to redirect the traffic from port 80 to port 443. I found this: https://github.com/kubernetes/ingress-gce/issues/1075 which let to this: https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#https_redirect.

建议的解决方案添加了带有RedirectToHttps标志的FrontendConfig,该标志使用了一些LoadBalancer功能.但是,当我尝试添加FrontendEndConfig时,出现以下错误:

The proposed solution adds a FrontendConfig with a RedirectToHttps flag which uses some LoadBalancer functionality. Yet when I try to add the FrontendEndConfig, I get the following error:

error: unable to recognize "ssl.yaml": no matches for kind "FrontendConfig" in version "networking.gke.io/v1beta1"

我也尝试过'networking.gke.io/v1'和'v1beta2'.我的区域中可用的最新GKE版本是1.17.13-gke.2001.我最近启动了集群,因此尽管我不知道如何检查GKE版本,但我认为它正在最新版本上运行.

I have also tried 'networking.gke.io/v1' and 'v1beta2'. The latest GKE version available in my zone is 1.17.13-gke.2001. I have recently launched the cluster so although I don't know how to check the GKE version, I reckon it's running on the latest version.

任何人都知道为什么我的kubectl无法识别这种情况吗?

Anyone has a clue why my kubectl doesn't recognize this kind?

入口Yaml:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: basic-ingress
  annotations:
    FrontendConfig: my-frontend-config
    kubernetes.io/ingress.global-static-ip-name: 'web-static-ip'
    networking.gke.io/managed-certificates: mycertificate
    # kubernetes.io/ingress.allow-http: "false"
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: frontend
          servicePort: 80
      - path: /api/*
        backend:
          serviceName: backend
          servicePort: 80

重定向Yaml:

apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
metadata:
  name: my-frontend-config
spec:
  redirectToHttps:
    enabled: true

推荐答案

感谢您指出正确的方向!

Thank you for pointing me in the right direction!

我必须按照MrKoopaKiller的指示升级群集,并更改注释:

I had to upgrade the cluster as MrKoopaKiller indicated and also changed the annotation:

FrontendConfig: my-frontend-config

收件人:

networking.gke.io/v1beta1.FrontendConfig: "my-frontend-config"

成功了!

还:确保您拥有:

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

这篇关于GKE入口Https重定向-FrontendConfig无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆