CertKeen

Certified Kubernetes Administrator (CKA) · Free practice question 3 of 12

Listing cluster-scoped API resources

While writing ClusterRoles at Saffron Lane Hotels, an admin needs a list of all resource types that are not namespaced. Which command produces it?

  1. A.kubectl explain --scope=cluster
  2. B.kubectl api-versions --cluster-scoped
  3. C.kubectl api-resources --namespaced=false
  4. D.kubectl get all --all-namespaces=false
Show answer and explanation

Correct answer: C. kubectl api-resources --namespaced=false

Why: kubectl api-resources lists every resource the API server serves, with short names, API groups and whether each is namespaced, and --namespaced=false filters to cluster-scoped kinds such as nodes and persistentvolumes. api-versions only lists group versions, get all returns a subset of namespaced objects, and explain documents fields of one resource.

More free Certified Kubernetes Administrator (CKA) questions