kubernetes 部署ingress gateway时,injection Template:gateway是什么意思?

hmmo2u0o  于 5个月前  发布在  Kubernetes
关注(0)|答案(2)|浏览(65)

部署ingress gateway时,injectionTemplate: gateway是什么意思?
这里提到:https://istio.io/latest/docs/setup/additional-setup/gateway/#deploying-a-gateway

values:
    gateways:
      istio-ingressgateway:
        # Enable gateway injection
        injectionTemplate: gateway

字符串
sidecar和gateway模板有什么区别?

daupos2t

daupos2t1#

引用Istio官方文档:https://istio.io/v1.12/docs/setup/additional-setup/sidecar-injection/#custom-templates-experimental
“Pod默认使用自动创建的sidecar注入模板。这可以被inject.istio.io/templates annotation覆盖。例如,要应用默认模板和我们的自定义,您可以设置inject.istio.io/templates=sidecar,custom。除了sidecar,默认提供gateway模板,以支持代理注入到Gateway部署中。”
看起来gateway注入模板是一个“自定义模板”,专门配置用于将sidecar注入到网关部署中。
较旧的入口和出口部署(v1.11.0及更早版本)默认不使用sidecar注入(injectionTemplate:“”),但最新的入口网关部署似乎默认使用gateway模板注入sidecar:https://artifacthub.io/packages/helm/istio-official/gateway
Istio建议为网关部署启用自动注入。来自https://istio.io/v1.12/docs/setup/additional-setup/gateway/#deploying-a-gateway:
“建议使用自动注入进行网关部署,因为它可以让开发人员完全控制网关部署,同时还可以简化操作。当有新的升级可用时,或者配置发生更改时,只需重新启动即可更新网关Pod。这使得操作网关部署的体验与操作Sidecar相同。”
唯一的问题是,我还没有让它使用gateway模板工作。我的ingressgateway pod从来没有旋转起来,我一直在部署日志中得到以下错误:

- type: ReplicaFailure
      status: 'True'
      lastUpdateTime: '2022-03-17T12:19:55Z'
      lastTransitionTime: '2022-03-17T12:19:55Z'
      reason: FailedCreate
      message: >-
        admission webhook "namespace.sidecar-injector.istio.io" denied the
        request: failed to run injection template: could not parse configuration
        values: json: cannot unmarshal number into Go value of type string

字符串
看起来这可能是一个关于gateway注入模板如何配置的上游问题。我也不知道在哪里可以获得关于默认sidecar模板和gateway模板之间的区别的更详细的答案。
在事情变得更清楚之前,我默认使用没有sidecar注入的旧的ingress部署。

v64noz0r

v64noz0r2#

您可以在helm中设置自定义模板如下:

sidecarInjectorWebhook
  templates:
    hello: |
      metadata:
        labels:
          hello: world

字符串

相关问题