Fab*_* B. 2 kubernetes istio kubernetes-cronjob
我有一个 k8s cronjob 运行我的 docker 镜像transaction-service
。
它启动并成功完成其工作。当它结束时,我希望 Pod 终止,但是......istio-proxy
仍然徘徊在那里:
结果是:
没什么太疯狂的,但我想解决它。
我知道我应该打电话curl -X POST http://localhost:15000/quitquitquit
但我不知道在哪里以及如何。仅当事务服务处于完成状态时,我才需要调用 quitquitquit URL。我读过有关preStop
生命周期钩子的内容,但我认为我需要更多postStop
。有什么建议么?
您在这里有几个选择:
command: ["/bin/bash", "-c"]
args:
- |
trap "curl --max-time 2 -s -f -XPOST http://127.0.0.1:15020/quitquitquit" EXIT
while ! curl -s -f http://127.0.0.1:15020/healthz/ready; do sleep 1; done
echo "Ready!"
< your job >
Run Code Online (Sandbox Code Playgroud)
apiVersion: batch/v1beta1
kind: CronJob
metadata:
...
spec:
...
jobTemplate:
spec:
template:
metadata:
annotations:
# disable istio on the pod due to this issue:
# https://github.com/istio/istio/issues/11659
sidecar.istio.io/inject: "false"
Run Code Online (Sandbox Code Playgroud)
注意:注释应该位于 Pod 的模板上,而不是 Job 的模板上。
归档时间: |
|
查看次数: |
4864 次 |
最近记录: |