我們有一個 Kubernetes 部署,我們想使用類似下面的命令在下面的清單中添加一個不安全的命令/標志
kubectl patch deploy xxxx --type='json' -p='[{"op": "add", "value":"nginx"}]'
請幫助如何實作這一點?
當前清單
spec:
.
.
template:
.
.
spec:
.
.
containers:
- command:
- argocd-server
新清單
spec:
.
.
template:
.
.
spec:
.
.
containers:
- command:
- argocd-server
- --insecure
uj5u.com熱心網友回復:
嘗試這個
kubectl patch deployment xxxx --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/command", "value": ["argocd-server", "--insecure"]}]'
并驗證command
kubectl get deployment xxxx -o=json | jq '.spec.template.spec.containers[0].command'
輸出
[
"argocd-server",
"--insecure"
]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/522438.html
