Kubernetes (delete Replica Sets)

12/20/2017

How can I remove replicasets from kubernetes? I use kubernetes-client java libs, the request there looks like this: /apis/extensions/v1beta1/namespaces/{namespace}/replicasets/{name} but I do not know the name replicasets, I know only label selector. Configure such a request does not allow me lib: /apis/extensions/v1beta1/namespaces/va/replicasets/labelSelector=app=some_name

-- Kirill Kotlyarov
java
kubernetes

1 Answer

2/16/2018

When you create a replica-set your return type from that method is an object representing the replica-set. You should be able to get the name of the replica-set from that object and then, later on, use it in order to delete it.

Another option would be to list all replica-sets, and add a label selector to this call. This will only return the replica-sets you're looking for and then you can delete those.

-- Ilya Chernomorin
Source: StackOverflow