我需要使用REST API删除kubernetes部署资源。这是可能的并且它可以工作,但我发现虽然部署资源被删除了,但它的关联ReplicaSet却没有。
这意味着它的pod仍在运行。
我不知道如何找到与部署关联的ReplicaSet的名称。
我在使用kubectl时可以看到它: kubectl描述部署mydeployment ,但我找不到REST方法来获取该信息。
有办法吗?
答案 0 :(得分:4)
查找关联调用的简单方法是使用具有更高级别详细程度(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
答案 1 :(得分:0)
您指出您想找到上述问题中的副本集。您可以找到
设置的副本 kubectl get rs -n deployment-namespace
rs:-复制集