Search code examples
pythonkubernetesstatefulset

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.


Solution

  • 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