google cloud build 执行 `kubectl get` 无法识别输出格式 json

问题描述 投票:0回答:1

在云构建日志中

"Running the following command: kubectl [get httproutes.gateway.networking.k8s.io --field-selector=metadata.name=test-name-http-route --output=json | jq -r '.spec.rules[]?.backendRefs[]? | select(.name == "test-name-service")']"
}
error: unable to match a printer suitable for the output format "json | jq -r '.spec.rules[]?.backendRefs[]? | select(.name == \"test-name-service\")'", allowed formats are: custom-columns,custom-columns-file,go-template,go-template-file,json,jsonpath,jsonpath-as-json,jsonpath-file,name,template,templatefile,wide,yaml

是因为云构建中没有安装

jq
吗?

我能够直接在

Google Cloud Shell
中运行该命令,没有错误:

kubectl get httproutes.gateway.networking.k8s.io --field-selector=metadata.name=test-name-http-route --output=json | jq -r '.spec.rules[]?.backendRefs[]? | select(.name == "test-name-service")'
json google-cloud-platform google-kubernetes-engine kubectl google-cloud-build
1个回答
0
投票

结果

jq
没有安装在我用来执行命令的映像中。

© www.soinside.com 2019 - 2023. All rights reserved.