简体   繁体   中英

How to delete statefulsets.apps using Kubernetes Python CoreV1API

I'm migrating helm2 releases to helm3 . One of my resources is redis and it's protected from migration. I have to remove it using

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

I wanna use the Kubernetes python lib, only that I cannot find the matching function. I'm using CoreV1API .

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

You must look in the right API Group.

I'm using CoreV1API.

StatefulSets is in AppsV1 and not in CoreV1 , so check that API Group instead.

See the Python Kubernetes client example for Deployment in AppsV1 API Group , it is very similar to StatefulSet

You can go through the following reference doc link which has reference for all the AppsV1 APIs including API usage for deleting the statefulset .

You need to use AppsV1Api , where you have delete_namespaced_stateful_set method.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM