我能够回滚pod。但是,我无法重新部署。以下是查询。
curl -u "auth" -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"replicaSetId":null}' 'URL?action=rollback'
有人知道怎么做吗?
答案 0 :(得分:2)
我同意在API中执行redeploy
操作会很好。但是现在您可以使用以下变通方法(取自official rancher forum,但由于错误我已修复了某些标头):
pod_upgrade_body=$(curl -u "token-[use your token here]" \
-s 'https://rancher.mydomain.com/v3/project/c-zqpm5:p-h884r/workloads/deployment:development:api' \
-X GET \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' 2>&1 | sed "s/\"cattle\.io\/timestamp\"\:\"[0-9T:Z-]*\"/\"cattle\.io\/timestamp\":\"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"/g")
curl -u "token-[use your token here]" \
-s 'https://rancher.mydomain.com/v3/project/c-zqpm5:p-h884r/workloads/deployment:development:api' \
-X PUT \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--data-binary "$pod_upgrade_body" --compressed