我正在使用kubectl来获取容器状态,在那里我只知道应该部署的image标签的开始。有什么方法可以做到这一点?
我尝试使用slice和StartsWith,但kubectl go-template似乎都不支持。
我相信,如果支持StartsWith,这应该可以工作:
kubectl get pods --all-namespaces -o 'go-template={{range .items}}{{$status := .status}}{{range .spec.containers}}{{if StartsWith .image '"\"$DEPLOY_IMAGE\""'}}{{$status.phase}}{{end}}{{end}}{{end}}'
我期望某种输出,但是我得到的是:
template: output:1: function "StartsWith" not defined