問題
アプリケーションコンテナが意図的にexitすると(特にJobの場合など)、Istioコンテナは実行され続けてしまう。
If an application container intentionally exits (typically from usage in a Job), Istio’s container will still run and keep the pod running indefinitely. This is also a top GitHub issue.
根本解決
k8s 1.29以降のsidecar containers
- https://istio.io/latest/blog/2023/native-sidecars/
- https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/
Workaround
command: ["/bin/bash", "-c"]
args:
- |
trap "curl --max-time 2 -s -f -XPOST http://127.0.0.1:15000/quitquitquit" EXIT
while ! curl -s -f http://127.0.0.1:15020/healthz/ready; do sleep 1; done
sleep 2
{{ $.Values.cron.command }}
curl -fsI -X POST http://localhost:15020/quitquitquit
が必要