我正在尝试使用以下命令使用 podip curl 到 pod 本身,因为目前我不希望 kubelet 请求我的 pod 进行健康检查。
livenessProbe:
exec:
command:
- curl
- $POD_IP:9990/admin/ping
initialDelaySeconds: 3
periodSeconds: 5
但这里无法识别环境变量 $POD_IP,
Could not resolve host: $POD_IP
如何配置它,以便命令中的 curl 可以读取 env var。
引用:
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#execaction-v1-core
最佳答案
尝试以下:
command:
- bash
- -c
- curl $POD_IP:9990/admin/ping
关于kubernetes - k8s : Unable to read environment variable in livenessProbes exec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49072047/