GKE Autopilot:如何add/manage SSL证书到GKE autopilot

GKE Autopilot: How to add/manage SSL Certificate to GKE autopilot

我最近设置了一个 GKE 自动驾驶仪,但意识到它不支持 cert-manager 所依赖的 webhooks。 add/manage SSL 证书到 GKE auto-pilot 集群的其他选项是什么?

截至 2021 年 5 月,GKE Autopilot 不支持第 3 方 Webhook。如果没有 webhooks,许多 Kubernetes 插件(例如 cert-manager)将无法正常运行。 Cert-manager 使用自定义变异准入 Webhook 来管理证书,这在 GKE Autopilot 上是不可变的。

要add/manage Autopilot 集群的 SSL 证书,您应该首先从这个官方 GCP 文档开始 Google-managed SSL certificates

您可以使用 ManagedCertificate 自定义资源配置 Google 管理的 SSL 证书,该资源有不同的 API 版本,具体取决于您的 GKE 集群版本。建议您使用较新的 API 版本。

  • ManagedCertificate v1beta2 API 在 GKE 集群版本中可用 1.15 及更高版本。
  • ManagedCertificate v1 API 在 GKE 集群版本中可用 1.17.9-gke.6300 及更高版本。

Note: Google-managed SSL certificates aren't currently supported for internal HTTPS load balancers. For internal HTTPS load balancers, use self-managed SSL certificates instead. This feature is only available for Ingress for External HTTP(S) Load Balancing, can read more here.

要配置 Google 管理的 SSL 证书并将其与 Ingress 关联,请先执行以下两个基本步骤:

  • 在与 入口。
  • 通过添加一个将 ManagedCertificate 对象关联到一个 Ingress Ingress 的注释 networking.gke.io/managed-certificates。 此注释是 ManagedCertificate 的逗号分隔列表 资源,例如 cert1、cert2、cert3。 其中详细提到here.

你必须关注一些prerequisites:

  • 您必须拥有该域名(Google Domains 或其他注册商)。
  • 你的“kubernetes.io/ingress.class”必须是“gce”.
  • 创建一个保留的(静态)外部 IP 地址。如果不预约 地址,它可能会更改,需要您重新配置您的域 DNS 记录。

要设置 Google 管理的证书,请通过 sample ManagedCertificate manifest

带有 GKE Autopilot 的证书管理器 is now compatible