HoldApplicationUntilProxyStarts 的开关来解决了该问题,开关打开后,proxy 将会注入到第一个 container。

HoldApplicationUntilProxyStarts 就会为 sidecar 添加一个 postStart hook:
kubectl -n istio-system edit cm istio
defaultConfig 下加入 holdApplicationUntilProxyStarts: trueapiVersion: v1data:mesh: |-defaultConfig:holdApplicationUntilProxyStarts: truemeshNetworks: 'networks: {}'kind: ConfigMap
meshConfig:apiVersion: install.istio.io/v1alpha1kind: IstioOperatormetadata:namespace: istio-systemname: example-istiocontrolplanespec:meshConfig:defaultConfig:holdApplicationUntilProxyStarts: true
proxy.istio.io/config 注解,将 holdApplicationUntilProxyStarts 置为 true,示例:apiVersion: apps/v1kind: Deploymentmetadata:name: nginxspec:replicas: 1selector:matchLabels:app: nginxtemplate:metadata:annotations:proxy.istio.io/config: |holdApplicationUntilProxyStarts: truelabels:app: nginxspec:containers:- name: nginximage: "nginx"
文档反馈