Fail to delete rc by api?

10/19/2015

kubernetes version:1.02
REST api
DELETE /api/v1/namespaces/default/replicationcontrollers/test
body

{
"apiVersion": "v1",
"kind": "ReplicationController",
"gracePeriodSeconds": 0}
}

Fail

{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "converting to : type names don't match (ReplicationController, DeleteOptions), and no conversion 'func (v1.ReplicationController, api.DeleteOptions) error' registered.",
"code": 500
}

if setting body is empty, delete success, but pod is exist.
kubectl get rc, rc is deleted
kubectl get pod, pod is existting

why?
How can I delete rc with all pods by api delete method?

-- ttyyll
kubernetes

1 Answer

10/19/2015

API requests are designed to be able to be fulfilled immediately. Tasks like reaping/recursively deleting are typically handled by a client by combining multiple API requests. In this case, you can do what kubectl does when running kubectl delete rc/test (which you can see by adding --v=8):

  1. Set the spec.replicas of rc/test to 0
  2. Watch until status.replicas of rc/test is also 0
  3. Delete rc/test
-- Jordan Liggitt
Source: StackOverflow