我想向 istio-ingressgateway 添加一个基于通配符的域名(例如 *.somedomain.com)并设置自签名 TLS 证书。GKE 上的 Istio 是通过从集群的插件列表中启用 Istio 来安装的。
第一个问题是是否建议配置和使用自动生成的 istio-ingressgateway 而不是创建一个。
如果是这样,那么第二个问题是如何更新该网关的设置。
我必须从自动创建的 ingressgateway 中包含labels、resourceVersion和selfLink字段,并将 resourceVersion 设置为当前版本,否则 Kubernetes 不接受新的 YAML 文件。
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
# QUESTION: Copid fields from the current ingressgateway to be specified.
# Otherwise, kubectl does not accept the settings.
# $ kubectl apply -f ./helm-charts/istio/gateway.yaml
# The gateways "istio-autogenerated-k8s-ingress" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update
# labels:
# addonmanager.kubernetes.io/mode: EnsureExists
# k8s-app: istio
# resourceVersion: "9331065"
# selfLink: /apis/networking.istio.io/v1alpha3/namespaces/istio-system/gateways/istio-autogenerated-k8s-ingressa
name: istio-autogenerated-k8s-ingress
namespace: istio-system
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 443
name: https
protocol: HTTPS
tls:
mode: PASSTHROUGH
serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
privateKey: /etc/istio/ingressgateway-certs/tls.key
hosts:
- "*.heportal.squiz.cloud"
如果我应用上面的示例 gateway.yaml 文件:
$ kubectl apply -f ./helm-charts/istio/gateway.yaml
The gateways "istio-autogenerated-k8s-ingress" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update