List all controllers running in Kubernetes

Viewed 9006

I just installed the controller via Helm, I can list the helm packages via helm list, but is it possible to list all the controllers running in the cluster via kubectl or api-query?

2 Answers

If you mean replication controller then you can list them by kubectl:

kubectl get replicationcontroller -n my-namespace

Or list them all from all the namespaces:

kubectl get rc --all-namespaces

And you can also use API:

curl http://localhost:8080/api/v1/replicationcontrollers

Update: You can list other controller types like replicaset (rs), deployment (deploy), statefulset, daemonset (ds) and job in the same way.

Not sure if there is a way to list controllers in k8s. every resource/object in k8s is controlled by a controller (control loop) with spec fields as values for desired state. if you have deployed a controller outside control plane (built-in controllers) then what i will do to find the controller:

  1. find the resource/object by running kubectl api-resources
  2. verify the list and find the resource name
  3. search all pods and grep the resource name kubectl get pods --all-namespaces |grep <resource-name>
  4. the pod in the above search will be running you controller
  5. NOTE: the pod name might not contain the resource name but it will contain some similar name. i just share this info to understand what a controller is and how external controller works other than (build in controllers).

more info - https://kubernetes.io/docs/concepts/architecture/controller/

Related