Home > Mobile >  Kubernetes python API get instances of CRD
Kubernetes python API get instances of CRD

Time:09-29

I'm currently using the Python APIs for Kubernetes and I have to (1) retrieve the instance of a custom resource name FADepl and (2) edit a value of that instance. In the terminal, I would simply list all FADepls with kubectl get fadepl and then edit the right one using kubectl edit fadepl <fadepl_name>. I checked the K8s APIs for Python, but I can't find what I need. Is it something I can do with the APIs?

Thank you in advance!

CodePudding user response:

I found the get_namespaced_custom_object call that should do the trick

CodePudding user response:

You're right. Using get_namespaced_custom_object you can retrieve the instance. This method returns a namespace scoped custom object. By default it uses a synchronous HTTP request.

Since the output of that method returns an object, you can simply replace it using replace_cluster_custom_object.

Here you can find implementation examples.

See also whole list of API Reference for Python.

  • Related