gpt4 book ai didi

istio - 禁用向作业 pod 注入(inject) Istio sidecar

转载 作者:行者123 更新时间:2023-12-03 21:43:58 29 4
gpt4 key购买 nike

如何为 Kubernetes 禁用 Istio sidecar 注入(inject) Job ?

apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: pod-restart
spec:
concurrencyPolicy: Forbid
schedule: '0 8 * * *'
jobTemplate:
metadata:
annotations:
sidecar.istio.io/inject: "false"
spec:
backoffLimit: 2
activeDeadlineSeconds: 600
template:
spec:
serviceAccountName: pod-restart
restartPolicy: Never
containers:
- name: kubectl
image: bitnami/kubectl
command: ['kubectl', 'rollout', 'restart', 'deployment/myapp']
Sidecar 仍然被注入(inject)。

最佳答案

注释在错误的位置。您必须将其放在 pod 模板上。

apiVersion: batch/v1beta1
kind: CronJob
metadata:
spec:
jobTemplate:
spec:
template:
metadata:
annotations:
sidecar.istio.io/inject: "false"

有一个禁用了 istio 注入(inject)的 CronJob 示例。
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
metadata:
annotations:
sidecar.istio.io/inject: "false"
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo "Hello, World!"
restartPolicy: OnFailure

还有相关的 github issue关于那个。

关于istio - 禁用向作业 pod 注入(inject) Istio sidecar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65807748/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com