2016-12-01 119 views
1

我需要使用REST API刪除kubernetes部署資源。這是可能的,它的工作原理,但我只是發現,雖然部署資源被刪除好了,但其關聯的ReplicaSet不是。使用Kubernetes REST API管理部署

這意味着它的豆莢仍在運行。

我不知道如何找到與部署關聯的副本集的名稱。

我可以看到它使用kubectl時:kubectl描述部署mydeployment,但我找不到REST方法來獲取該信息。

有沒有辦法?

回答

2

找到相關呼叫的簡單方法是使用具有較高冗長級別的相關kubectl命令(--v=6--v=9)。

#~ kubectl delete deployment nginx-deployment --v=6 
I1201 12:26:16.511683 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/deployments/nginx-deployment 200 OK in 50 milliseconds 
I1201 12:26:16.568980 6235 round_trippers.go:318] PUT https://XXX/apis/extensions/v1beta1/namespaces/default/deployments/nginx-deployment 200 OK in 50 milliseconds 
I1201 12:26:17.621751 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/deployments/nginx-deployment 200 OK in 50 milliseconds 
I1201 12:26:17.680228 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets?labelSelector=app%3Dnginx 200 OK in 50 milliseconds 
I1201 12:26:17.738684 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets/nginx-deployment-4087004473 200 OK in 56 milliseconds 
I1201 12:26:18.790243 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets/nginx-deployment-4087004473 200 OK in 49 milliseconds 
I1201 12:26:18.843446 6235 round_trippers.go:318] PUT https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets/nginx-deployment-4087004473 200 OK in 50 milliseconds 
I1201 12:26:18.894538 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets/nginx-deployment-4087004473 200 OK in 49 milliseconds 
I1201 12:26:19.946417 6235 round_trippers.go:318] GET https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets/nginx-deployment-4087004473 200 OK in 49 milliseconds 
I1201 12:26:20.001367 6235 round_trippers.go:318] DELETE https://XXX/apis/extensions/v1beta1/namespaces/default/replicasets/nginx-deployment-4087004473 200 OK in 53 milliseconds 
I1201 12:26:20.055669 6235 round_trippers.go:318] DELETE https://XXX/apis/extensions/v1beta1/namespaces/default/deployments/nginx-deployment 200 OK in 53 milliseconds 
+0

不錯,labelSelector是絕招,非常感謝! – stibi