How to delete a kubernetes deployment using kubernetes python client?

542 Views Asked by At

I cannot find the python function to delete a kubernetes deployment. I can delete the pods but that would only cause the deployment to restart the pods again. Basically I want the equivalent of kubectl delete deployment deployment1 --namespace nms.

1

There are 1 best solutions below

0
On

Looks like it doesn't exists a delete_from_yaml.py lib. After following several GitHub history the last update is 12d ago, apparently because it lacks contributors. ( https://github.com/kubernetes-client/python/pull/1392 )

enter image description here

Solutions:

  • Maybe you can use the code proposed in the above PR
  • Create your own PR
  • use kubectl delete command for this...

Bguess