kubernetes seems to have lot of objects. I can't seem to find the full list of objects anywhere. After briefly searching on google, I can find results which mention a subset of kubernetes objects. Is the full list of objects documented somewhere, perhaps in source code? Thank you.
Configuration files are typically stored in source control, such as Git. live object configuration / live configuration: The live configuration values of an object, as observed by the Kubernetes cluster. These are kept in the Kubernetes cluster storage, typically etcd.
The most basic command for viewing Kubernetes objects via kubectl is get . If you run kubectl get <resource-name> you will get a listing of all resources in the current namespace. If you want to get a specific resource, you can use kubectl get <resource-name> <object-name> .
Following command successfully display all kubernetes objects
kubectl api-resources
Example
[root@hsk-controller ~]# kubectl api-resources NAME SHORTNAMES KIND bindings Binding componentstatuses cs ComponentStatus configmaps cm ConfigMap endpoints ep Endpoints events ev Event limitranges limits LimitRange namespaces ns Namespace nodes no Node persistentvolumeclaims pvc PersistentVolumeClaim persistentvolumes pv PersistentVolume pods po Pod podtemplates PodTemplate replicationcontrollers rc ReplicationController resourcequotas quota ResourceQuota secrets Secret serviceaccounts sa ServiceAccount services svc Service initializerconfigurations InitializerConfiguration mutatingwebhookconfigurations MutatingWebhookConfiguration validatingwebhookconfigurations ValidatingWebhookConfiguration customresourcedefinitions crd,crds CustomResourceDefinition apiservices APIService controllerrevisions ControllerRevision daemonsets ds DaemonSet deployments deploy Deployment replicasets rs ReplicaSet statefulsets sts StatefulSet tokenreviews TokenReview localsubjectaccessreviews LocalSubjectAccessReview selfsubjectaccessreviews SelfSubjectAccessReview selfsubjectrulesreviews SelfSubjectRulesReview subjectaccessreviews SubjectAccessReview horizontalpodautoscalers hpa HorizontalPodAutoscaler cronjobs cj CronJob jobs Job brpolices br,bp BrPolicy clusters rcc Cluster filesystems rcfs Filesystem objectstores rco ObjectStore pools rcp Pool certificatesigningrequests csr CertificateSigningRequest leases Lease events ev Event daemonsets ds DaemonSet deployments deploy Deployment ingresses ing Ingress networkpolicies netpol NetworkPolicy podsecuritypolicies psp PodSecurityPolicy replicasets rs ReplicaSet nodes NodeMetrics pods PodMetrics networkpolicies netpol NetworkPolicy poddisruptionbudgets pdb PodDisruptionBudget podsecuritypolicies psp PodSecurityPolicy clusterrolebindings ClusterRoleBinding clusterroles ClusterRole rolebindings RoleBinding roles Role volumes rv Volume priorityclasses pc PriorityClass storageclasses sc StorageClass volumeattachments VolumeAttachment
Note: kubernate version is v1.12*
kubectl version
The following command list all supported API versions:
$ kubectl api-versions
You can have a bit detailed information from kube-apiserver
REST API:
Open connection to kube-apiserver
$ kubectl proxy &
Now you can discover API resources:
This request gives you all existed paths on apiserver (in JSON format):
$ curl http://localhost:8001/ "/apis/extensions/v1beta1", "/apis/networking.k8s.io", "/apis/networking.k8s.io/v1", "/apis/policy", "/apis/policy/v1beta1", "/apis/rbac.authorization.k8s.io", "/apis/rbac.authorization.k8s.io/v1", ... "/version" ] }
You can request details about particular path:
curl http://localhost:8001/api/v1 ... { "name": "configmaps", "singularName": "", "namespaced": true, "kind": "ConfigMap", "verbs": [ "create", "delete", "deletecollection", "get", "list", "patch", "update", "watch" ], "shortNames": [ "cm" ] }, ...
This information helps you to write kubectl
commands, e.g.:
$ kubectl get configmaps $ kubectl get cm
But you may find more convenient to use built-in documentation provided by kubectl explain
.
For example, this command shows you a list of Kubernetes objects:
$ kubectl explain
You can have detailed information about any of listed resources:
$ kubectl explain rc $ kubectl explain rc.spec $ kubectl explain rc.spec.selector
Or you can print full blown YAML template(or part) of the object by adding --recursive flag:
$ kubectl explain rc --recursive $ kubectl explain rc.metadata --recursive
Links in the desctiption points to the documentation about particular object. E.g.:
DESCRIPTION: If the Labels of a ReplicationController are empty, they are defaulted to be the same as the Pod(s) that the replication controller manages. Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.
If you need complete description with examples you can always find it in the official API Reference (or the older version), mentioned by Matthew L Daniel
You also might find helpful kubectl Reference or kubectl Cheatsheet
Update: Using the following one-liner you can list all objects grouped by API versions (including CRDs). It may be useful to check if an object is present in more than one API group and therefore more than one apiVersion is applicable in its manifest. (For different apiVersions object configuration may be slightly different.)
a=$(kubectl api-versions) ; for n in $a ; do echo ; echo "apiVersion: $n" ; kubectl api-resources --api-group="${n%/*}" ; done
Partial example output:
... apiVersion: autoscaling/v1 NAME SHORTNAMES APIGROUP NAMESPACED KIND horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler apiVersion: autoscaling/v2beta1 NAME SHORTNAMES APIGROUP NAMESPACED KIND horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler apiVersion: autoscaling/v2beta2 NAME SHORTNAMES APIGROUP NAMESPACED KIND horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler apiVersion: batch/v1 NAME SHORTNAMES APIGROUP NAMESPACED KIND cronjobs cj batch true CronJob jobs batch true Job apiVersion: batch/v1beta1 NAME SHORTNAMES APIGROUP NAMESPACED KIND cronjobs cj batch true CronJob jobs batch true Job ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With