istio sidecar 注入不起作用

istio sidecar 注入不起作用

我已经在 k8s 集群中安装了 istio,并使用以下代码标记了我想要的命名空间

istio-injection=enabled

但是,当我安装 pod 时,它不会注入 sidecar。

我按照此页面上的说明进行操作:https://istio.io/latest/docs/ops/common-problems/injection/#automatic-sidecar-injection-fails-if-the-kubernetes-api-server-has-proxy-settings

我发现我的 webhook namespaceSelectors 不正确:

$ kubectl get mutatingwebhookconfiguration istio-sidecar-injector -o yaml | grep "namespaceSelector:" -A5
  namespaceSelector:
    matchLabels:
      istio.io/deactivated: never-match
  objectSelector:
    matchLabels:
      istio.io/deactivated: never-match
--
  namespaceSelector:
    matchLabels:
      istio.io/deactivated: never-match
  objectSelector:
    matchLabels:
      istio.io/deactivated: never-match
--
  namespaceSelector:
    matchLabels:
      istio.io/deactivated: never-match
  objectSelector:
    matchLabels:
      istio.io/deactivated: never-match
--
  namespaceSelector:
    matchLabels:
      istio.io/deactivated: never-match
  objectSelector:
    matchLabels:
      istio.io/deactivated: never-match

根据该页面,它们应该是:

  namespaceSelector:
    matchLabels:
      istio-injection: enabled
  rules:
  - apiGroups:
    - ""

为什么 Webhook 命名空间选择器安装不正确?我已清除安装并重试,但重新安装后 Webhook 选择器总是错误的。

我怎样才能解决这个问题?

相关内容