如何使用 Kubernetes Python CoreV1API 删除 statefulsets.apps

How to delete statefulsets.apps using Kubernetes Python CoreV1API

我正在将 helm2 版本迁移到 helm3。我的资源之一是 redis,它受到保护,不会迁移。我必须使用

删除它
kubectl delete statefulsets.apps --cascade=false -nkube-system testme-redis-master

我想用Kubernetes python库,只是找不到匹配的函数。 我正在使用 CoreV1API.

I wanna use the Kubernetes python lib, only that I cannot find the matching function.

你必须在正确的 API 组中查找。

I'm using CoreV1API.

StatefulSetsAppsV1 中而不在 CoreV1 中,因此请检查 API 组。

查看Python Kubernetes客户端example for Deployment in AppsV1 API Group,与StatefulSet

非常相似

您可以通过 following reference doc link which has reference for all the AppsV1 APIs including API usage for deleting the statefulset.

您需要使用 AppsV1Api,其中您有 delete_namespaced_stateful_set 方法。

https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/AppsV1Api.md#delete_namespaced_stateful_set