kubectl api-resources

From wikieduonline
Jump to navigation Jump to search

kubectl api-resources
kubectl api-resources --help
kubectl api-resources --api-group=rbac.authorization.k8s.io
kubectl api-resources | tail -n +2 | wc -l
130

Play with K8s:

kubectl api-resources | tail -n +2 | wc -l
55
kubectl api-resources grep -i linkerd
metrics.k8s.io
monitoring.coreos.com
status.gatekeeper.sh
k8s.nginx.org
certificates.k8s.io

EKS: kubectl api-resources[edit]

kubectl version --short=true
Client Version: v1.22.3
Server Version: v1.21.2-eks-06eac09
kubectl api-resources
NAME   SHORTNAMES   APIVERSION   NAMESPACED   KIND
error: You must be logged in to the server (Unauthorized)

List all resources from a namespace:

  • kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --ignore-not-found --show-kind -n your-namespace
kubectl api-resources
NAME                              SHORTNAMES   APIVERSION                             NAMESPACED   KIND
bindings                                       v1                                     true         Binding
componentstatuses                 cs           v1                                     false        ComponentStatus
configmaps                        cm           v1                                     true         ConfigMap
endpoints                         ep           v1                                     true         Endpoints
events                            ev           v1                                     true         Event
limitranges                       limits       v1                                     true         LimitRange
namespaces                        ns           v1                                     false        Namespace
nodes                             no           v1                                     false        Node
persistentvolumeclaims            pvc          v1                                     true         PersistentVolumeClaim
persistentvolumes                 pv           v1                                     false        PersistentVolume
pods                              po           v1                                     true         Pod
podtemplates                                   v1                                     true         PodTemplate
replicationcontrollers            rc           v1                                     true         ReplicationController
resourcequotas                    quota        v1                                     true         ResourceQuota
secrets                                        v1                                     true         Secret
serviceaccounts                   sa           v1                                     true         ServiceAccount
services                          svc          v1                                     true         Service
mutatingwebhookconfigurations                  admissionregistration.k8s.io/v1        false        MutatingWebhookConfiguration
validatingwebhookconfigurations                admissionregistration.k8s.io/v1        false        ValidatingWebhookConfiguration
customresourcedefinitions         crd,crds     apiextensions.k8s.io/v1                false        CustomResourceDefinition
apiservices                                    apiregistration.k8s.io/v1              false        APIService
controllerrevisions                            apps/v1                                true         ControllerRevision
daemonsets                        ds           apps/v1                                true         DaemonSet
deployments                       deploy       apps/v1                                true         Deployment
replicasets                       rs           apps/v1                                true         ReplicaSet
statefulsets                      sts          apps/v1                                true         StatefulSet
tokenreviews                                   authentication.k8s.io/v1               false        TokenReview
localsubjectaccessreviews                      authorization.k8s.io/v1                true         LocalSubjectAccessReview
selfsubjectaccessreviews                       authorization.k8s.io/v1                false        SelfSubjectAccessReview
selfsubjectrulesreviews                        authorization.k8s.io/v1                false        SelfSubjectRulesReview
subjectaccessreviews                           authorization.k8s.io/v1                false        SubjectAccessReview
horizontalpodautoscalers          hpa          autoscaling/v1                         true         HorizontalPodAutoscaler
cronjobs                          cj           batch/v1                               true         CronJob
jobs                                           batch/v1                               true         Job
certificatesigningrequests        csr          certificates.k8s.io/v1                 false        CertificateSigningRequest
leases                                         coordination.k8s.io/v1                 true         Lease
eniconfigs                                     crd.k8s.amazonaws.com/v1alpha1         false        ENIConfig
endpointslices                                 discovery.k8s.io/v1                    true         EndpointSlice
events                            ev           events.k8s.io/v1                       true         Event
ingresses                         ing          extensions/v1beta1                     true         Ingress
flowschemas                                    flowcontrol.apiserver.k8s.io/v1beta1   false        FlowSchema
prioritylevelconfigurations                    flowcontrol.apiserver.k8s.io/v1beta1   false        PriorityLevelConfiguration
ingressclasses                                 networking.k8s.io/v1                   false        IngressClass
ingresses                         ing          networking.k8s.io/v1                   true         Ingress
networkpolicies                   netpol       networking.k8s.io/v1                   true         NetworkPolicy
runtimeclasses                                 node.k8s.io/v1                         false        RuntimeClass
poddisruptionbudgets              pdb          policy/v1                              true         PodDisruptionBudget
podsecuritypolicies               psp          policy/v1beta1                         false        PodSecurityPolicy
clusterrolebindings                            rbac.authorization.k8s.io/v1           false        ClusterRoleBinding
clusterroles                                   rbac.authorization.k8s.io/v1           false        ClusterRole
rolebindings                                   rbac.authorization.k8s.io/v1           true         RoleBinding
roles                                          rbac.authorization.k8s.io/v1           true         Role
priorityclasses                   pc           scheduling.k8s.io/v1                   false        PriorityClass
csidrivers                                     storage.k8s.io/v1                      false        CSIDriver
csinodes                                       storage.k8s.io/v1                      false        CSINode
csistoragecapacities                           storage.k8s.io/v1beta1                 true         CSIStorageCapacity
storageclasses                    sc           storage.k8s.io/v1                      false        StorageClass
volumeattachments                              storage.k8s.io/v1                      false        VolumeAttachment
securitygrouppolicies             sgp          vpcresources.k8s.aws/v1beta1           true         SecurityGroupPolicy

Play with K8s[edit]

NAME                              SHORTNAMES   APIVERSION                             NAMESPACED   KIND
bindings                                       v1                                     true         Binding
componentstatuses                 cs           v1                                     false        ComponentStatus
configmaps                        cm           v1                                     true         ConfigMap
endpoints                         ep           v1                                     true         Endpoints
events                            ev           v1                                     true         Event
limitranges                       limits       v1                                     true         LimitRange
namespaces                        ns           v1                                     false        Namespace
nodes                             no           v1                                     false        Node
persistentvolumeclaims            pvc          v1                                     true         PersistentVolumeClaim
persistentvolumes                 pv           v1                                     false        PersistentVolume
pods                              po           v1                                     true         Pod
podtemplates                                   v1                                     true         PodTemplate
replicationcontrollers            rc           v1                                     true         ReplicationController
resourcequotas                    quota        v1                                     true         ResourceQuota
secrets                                        v1                                     true         Secret
serviceaccounts                   sa           v1                                     true         ServiceAccount
services                          svc          v1                                     true         Service
mutatingwebhookconfigurations                  admissionregistration.k8s.io/v1        false        MutatingWebhookConfiguration
validatingwebhookconfigurations                admissionregistration.k8s.io/v1        false        ValidatingWebhookConfiguration
customresourcedefinitions         crd,crds     apiextensions.k8s.io/v1                false        CustomResourceDefinition
apiservices                                    apiregistration.k8s.io/v1              false        APIService
controllerrevisions                            apps/v1                                true         ControllerRevision
daemonsets                        ds           apps/v1                                true         DaemonSet
deployments                       deploy       apps/v1                                true         Deployment
replicasets                       rs           apps/v1                                true         ReplicaSet
statefulsets                      sts          apps/v1                                true         StatefulSet
tokenreviews                                   authentication.k8s.io/v1               false        TokenReview
localsubjectaccessreviews                      authorization.k8s.io/v1                true         LocalSubjectAccessReview
selfsubjectaccessreviews                       authorization.k8s.io/v1                false        SelfSubjectAccessReview
selfsubjectrulesreviews                        authorization.k8s.io/v1                false        SelfSubjectRulesReview
subjectaccessreviews                           authorization.k8s.io/v1                false        SubjectAccessReview
horizontalpodautoscalers          hpa          autoscaling/v2                         true         HorizontalPodAutoscaler
cronjobs                          cj           batch/v1                               true         CronJob
jobs                                           batch/v1                               true         Job
certificatesigningrequests        csr          certificates.k8s.io/v1                 false        CertificateSigningRequest
leases                                         coordination.k8s.io/v1                 true         Lease
endpointslices                                 discovery.k8s.io/v1                    true         EndpointSlice
events                            ev           events.k8s.io/v1                       true         Event
flowschemas                                    flowcontrol.apiserver.k8s.io/v1beta3   false        FlowSchema
prioritylevelconfigurations                    flowcontrol.apiserver.k8s.io/v1beta3   false        PriorityLevelConfiguration
ingressclasses                                 networking.k8s.io/v1                   false        IngressClass
ingresses                         ing          networking.k8s.io/v1                   true         Ingress
networkpolicies                   netpol       networking.k8s.io/v1                   true         NetworkPolicy
runtimeclasses                                 node.k8s.io/v1                         false        RuntimeClass
poddisruptionbudgets              pdb          policy/v1                              true         PodDisruptionBudget
clusterrolebindings                            rbac.authorization.k8s.io/v1           false        ClusterRoleBinding
clusterroles                                   rbac.authorization.k8s.io/v1           false        ClusterRole
rolebindings                                   rbac.authorization.k8s.io/v1           true         RoleBinding
roles                                          rbac.authorization.k8s.io/v1           true         Role
priorityclasses                   pc           scheduling.k8s.io/v1                   false        PriorityClass
csidrivers                                     storage.k8s.io/v1                      false        CSIDriver
csinodes                                       storage.k8s.io/v1                      false        CSINode
csistoragecapacities                           storage.k8s.io/v1                      true         CSIStorageCapacity
storageclasses                    sc           storage.k8s.io/v1                      false        StorageClass
volumeattachments                              storage.k8s.io/v1                      false        VolumeAttachment

Minikube[edit]

kubectl api-resources 
NAME                              SHORTNAMES   APIGROUP                       NAMESPACED   KIND
bindings                                                                      true         Binding
componentstatuses                 cs                                          false        ComponentStatus
configmaps                        cm                                          true         ConfigMap
endpoints                         ep                                          true         Endpoints
events                            ev                                          true         Event
limitranges                       limits                                      true         LimitRange
namespaces                        ns                                          false        Namespace
nodes                             no                                          false        Node
persistentvolumeclaims            pvc                                         true         PersistentVolumeClaim
persistentvolumes                 pv                                          false        PersistentVolume
pods                              po                                          true         Pod
podtemplates                                                                  true         PodTemplate
replicationcontrollers            rc                                          true         ReplicationController
resourcequotas                    quota                                       true         ResourceQuota
secrets                                                                       true         Secret
serviceaccounts                   sa                                          true         ServiceAccount
services                          svc                                         true         Service
mutatingwebhookconfigurations                  admissionregistration.k8s.io   false        MutatingWebhookConfiguration
validatingwebhookconfigurations                admissionregistration.k8s.io   false        ValidatingWebhookConfiguration
customresourcedefinitions         crd,crds     apiextensions.k8s.io           false        CustomResourceDefinition
apiservices                                    apiregistration.k8s.io         false        APIService
controllerrevisions                            apps                           true         ControllerRevision
daemonsets                        ds           apps                           true         DaemonSet
deployments                       deploy       apps                           true         Deployment
replicasets                       rs           apps                           true         ReplicaSet
statefulsets                      sts          apps                           true         StatefulSet
tokenreviews                                   authentication.k8s.io          false        TokenReview
localsubjectaccessreviews                      authorization.k8s.io           true         LocalSubjectAccessReview
selfsubjectaccessreviews                       authorization.k8s.io           false        SelfSubjectAccessReview
selfsubjectrulesreviews                        authorization.k8s.io           false        SelfSubjectRulesReview
subjectaccessreviews                           authorization.k8s.io           false        SubjectAccessReview
horizontalpodautoscalers          hpa          autoscaling                    true         HorizontalPodAutoscaler
cronjobs                          cj           batch                          true         CronJob
jobs                                           batch                          true         Job
certificatesigningrequests        csr          certificates.k8s.io            false        CertificateSigningRequest
leases                                         coordination.k8s.io            true         Lease
endpointslices                                 discovery.k8s.io               true         EndpointSlice
events                            ev           events.k8s.io                  true         Event
ingresses                         ing          extensions                     true         Ingress
ingressclasses                                 networking.k8s.io              false        IngressClass
ingresses                         ing          networking.k8s.io              true         Ingress
networkpolicies                   netpol       networking.k8s.io              true         NetworkPolicy
runtimeclasses                                 node.k8s.io                    false        RuntimeClass
poddisruptionbudgets              pdb          policy                         true         PodDisruptionBudget
podsecuritypolicies               psp          policy                         false        PodSecurityPolicy
clusterrolebindings                            rbac.authorization.k8s.io      false        ClusterRoleBinding
clusterroles                                   rbac.authorization.k8s.io      false        ClusterRole
rolebindings                                   rbac.authorization.k8s.io      true         RoleBinding
roles                                          rbac.authorization.k8s.io      true         Role
priorityclasses                   pc           scheduling.k8s.io              false        PriorityClass
csidrivers                                     storage.k8s.io                 false        CSIDriver
csinodes                                       storage.k8s.io                 false        CSINode
storageclasses                    sc           storage.k8s.io                 false        StorageClass
volumeattachments                              storage.k8s.io                 false        VolumeAttachment

EKS: velero[edit]

NAME                              SHORTNAMES           APIVERSION                             NAMESPACED   KIND
bindings                                               v1                                     true         Binding
componentstatuses                 cs                   v1                                     false        ComponentStatus
configmaps                        cm                   v1                                     true         ConfigMap
endpoints                         ep                   v1                                     true         Endpoints
events                            ev                   v1                                     true         Event
limitranges                       limits               v1                                     true         LimitRange
namespaces                        ns                   v1                                     false        Namespace
nodes                             no                   v1                                     false        Node
persistentvolumeclaims            pvc                  v1                                     true         PersistentVolumeClaim
persistentvolumes                 pv                   v1                                     false        PersistentVolume
pods                              po                   v1                                     true         Pod
podtemplates                                           v1                                     true         PodTemplate
replicationcontrollers            rc                   v1                                     true         ReplicationController
resourcequotas                    quota                v1                                     true         ResourceQuota
secrets                                                v1                                     true         Secret
serviceaccounts                   sa                   v1                                     true         ServiceAccount
services                          svc                  v1                                     true         Service
mutatingwebhookconfigurations                          admissionregistration.k8s.io/v1        false        MutatingWebhookConfiguration
validatingwebhookconfigurations                        admissionregistration.k8s.io/v1        false        ValidatingWebhookConfiguration
customresourcedefinitions         crd,crds             apiextensions.k8s.io/v1                false        CustomResourceDefinition
apiservices                                            apiregistration.k8s.io/v1              false        APIService
aplogconfs                                             appprotect.f5.com/v1beta1              true         APLogConf
appolicies                                             appprotect.f5.com/v1beta1              true         APPolicy
apusersigs                                             appprotect.f5.com/v1beta1              true         APUserSig
apdoslogconfs                                          appprotectdos.f5.com/v1beta1           true         APDosLogConf
apdospolicies                                          appprotectdos.f5.com/v1beta1           true         APDosPolicy
dosprotectedresources             pr                   appprotectdos.f5.com/v1beta1           true         DosProtectedResource
controllerrevisions                                    apps/v1                                true         ControllerRevision
daemonsets                        ds                   apps/v1                                true         DaemonSet
deployments                       deploy               apps/v1                                true         Deployment
replicasets                       rs                   apps/v1                                true         ReplicaSet
statefulsets                      sts                  apps/v1                                true         StatefulSet
clusterconfigauditreports         clusterconfigaudit   aquasecurity.github.io/v1alpha1        false        ClusterConfigAuditReport
configauditreports                configaudit          aquasecurity.github.io/v1alpha1        true         ConfigAuditReport
applications                      app,apps             argoproj.io/v1alpha1                   true         Application
applicationsets                   appset,appsets       argoproj.io/v1alpha1                   true         ApplicationSet
appprojects                       appproj,appprojs     argoproj.io/v1alpha1                   true         AppProject
tokenreviews                                           authentication.k8s.io/v1               false        TokenReview
localsubjectaccessreviews                              authorization.k8s.io/v1                true         LocalSubjectAccessReview
selfsubjectaccessreviews                               authorization.k8s.io/v1                false        SelfSubjectAccessReview
selfsubjectrulesreviews                                authorization.k8s.io/v1                false        SelfSubjectRulesReview
subjectaccessreviews                                   authorization.k8s.io/v1                false        SubjectAccessReview
horizontalpodautoscalers          hpa                  autoscaling/v2                         true         HorizontalPodAutoscaler
cronjobs                          cj                   batch/v1                               true         CronJob
jobs                                                   batch/v1                               true         Job
apps                                                   catalog.cattle.io/v1                   true         App
clusterrepos                                           catalog.cattle.io/v1                   false        ClusterRepo
operations                                             catalog.cattle.io/v1                   true         Operation
certificatesigningrequests        csr                  certificates.k8s.io/v1                 false        CertificateSigningRequest
configs                                                config.gatekeeper.sh/v1alpha1          true         Config
k8sallowedrepos                                        constraints.gatekeeper.sh/v1beta1      false        K8sAllowedRepos
k8spspprivilegedcontainer                              constraints.gatekeeper.sh/v1beta1      false        K8sPSPPrivilegedContainer
k8srequiredlabels                                      constraints.gatekeeper.sh/v1beta1      false        K8sRequiredLabels
leases                                                 coordination.k8s.io/v1                 true         Lease
eniconfigs                                             crd.k8s.amazonaws.com/v1alpha1         false        ENIConfig
endpointslices                                         discovery.k8s.io/v1                    true         EndpointSlice
events                            ev                   events.k8s.io/v1                       true         Event
providers                                              externaldata.gatekeeper.sh/v1alpha1    false        Provider
dnsendpoints                                           externaldns.nginx.org/v1               true         DNSEndpoint
flowschemas                                            flowcontrol.apiserver.k8s.io/v1beta2   false        FlowSchema
prioritylevelconfigurations                            flowcontrol.apiserver.k8s.io/v1beta2   false        PriorityLevelConfiguration
projecthelmcharts                                      helm.cattle.io/v1alpha1                true         ProjectHelmChart
globalconfigurations              gc                   k8s.nginx.org/v1alpha1                 true         GlobalConfiguration
policies                          pol                  k8s.nginx.org/v1                       true         Policy
transportservers                  ts                   k8s.nginx.org/v1alpha1                 true         TransportServer
virtualserverroutes               vsr                  k8s.nginx.org/v1                       true         VirtualServerRoute
virtualservers                    vs                   k8s.nginx.org/v1                       true         VirtualServer
apiservices                                            management.cattle.io/v3                false        APIService
authconfigs                                            management.cattle.io/v3                false        AuthConfig
clusterregistrationtokens                              management.cattle.io/v3                true         ClusterRegistrationToken
clusters                                               management.cattle.io/v3                false        Cluster
features                                               management.cattle.io/v3                false        Feature
groupmembers                                           management.cattle.io/v3                false        GroupMember
groups                                                 management.cattle.io/v3                false        Group
preferences                                            management.cattle.io/v3                true         Preference
settings                                               management.cattle.io/v3                false        Setting
tokens                                                 management.cattle.io/v3                false        Token
userattributes                                         management.cattle.io/v3                false        UserAttribute
users                                                  management.cattle.io/v3                false        User
nodes                                                  metrics.k8s.io/v1beta1                 false        NodeMetrics
pods                                                   metrics.k8s.io/v1beta1                 true         PodMetrics
alertmanagerconfigs               amcfg                monitoring.coreos.com/v1alpha1         true         AlertmanagerConfig
alertmanagers                     am                   monitoring.coreos.com/v1               true         Alertmanager
podmonitors                                            monitoring.coreos.com/v1               true         PodMonitor
probes                            prb                  monitoring.coreos.com/v1               true         Probe
prometheuses                                           monitoring.coreos.com/v1               true         Prometheus
prometheusrules                   promrule             monitoring.coreos.com/v1               true         PrometheusRule
servicemonitors                                        monitoring.coreos.com/v1               true         ServiceMonitor
thanosrulers                      ruler                monitoring.coreos.com/v1               true         ThanosRuler
assign                                                 mutations.gatekeeper.sh/v1beta1        false        Assign
assignmetadata                                         mutations.gatekeeper.sh/v1beta1        false        AssignMetadata
modifyset                                              mutations.gatekeeper.sh/v1beta1        false        ModifySet
policyendpoints                                        networking.k8s.aws/v1alpha1            true         PolicyEndpoint
ingressclasses                                         networking.k8s.io/v1                   false        IngressClass
ingresses                         ing                  networking.k8s.io/v1                   true         Ingress
networkpolicies                   netpol               networking.k8s.io/v1                   true         NetworkPolicy
runtimeclasses                                         node.k8s.io/v1                         false        RuntimeClass
poddisruptionbudgets              pdb                  policy/v1                              true         PodDisruptionBudget
podsecuritypolicies               psp                  policy/v1beta1                         false        PodSecurityPolicy
clusterrolebindings                                    rbac.authorization.k8s.io/v1           false        ClusterRoleBinding
clusterroles                                           rbac.authorization.k8s.io/v1           false        ClusterRole
rolebindings                                           rbac.authorization.k8s.io/v1           true         RoleBinding
roles                                                  rbac.authorization.k8s.io/v1           true         Role
priorityclasses                   pc                   scheduling.k8s.io/v1                   false        PriorityClass
volumesnapshotclasses             vsclass,vsclasses    snapshot.storage.k8s.io/v1             false        VolumeSnapshotClass
volumesnapshotcontents            vsc,vscs             snapshot.storage.k8s.io/v1             false        VolumeSnapshotContent
volumesnapshots                   vs                   snapshot.storage.k8s.io/v1             true         VolumeSnapshot
constraintpodstatuses                                  status.gatekeeper.sh/v1beta1           true         ConstraintPodStatus
constrainttemplatepodstatuses                          status.gatekeeper.sh/v1beta1           true         ConstraintTemplatePodStatus
mutatorpodstatuses                                     status.gatekeeper.sh/v1beta1           true         MutatorPodStatus
csidrivers                                             storage.k8s.io/v1                      false        CSIDriver
csinodes                                               storage.k8s.io/v1                      false        CSINode
csistoragecapacities                                   storage.k8s.io/v1beta1                 true         CSIStorageCapacity
storageclasses                    sc                   storage.k8s.io/v1                      false        StorageClass
volumeattachments                                      storage.k8s.io/v1                      false        VolumeAttachment
constrainttemplates                                    templates.gatekeeper.sh/v1             false        ConstraintTemplate
navlinks                                               ui.cattle.io/v1                        false        NavLink
backups                                                velero.io/v1                           true         Backup
backupstoragelocations            bsl                  velero.io/v1                           true         BackupStorageLocation
deletebackuprequests                                   velero.io/v1                           true         DeleteBackupRequest
downloadrequests                                       velero.io/v1                           true         DownloadRequest
podvolumebackups                                       velero.io/v1                           true         PodVolumeBackup
podvolumerestores                                      velero.io/v1                           true         PodVolumeRestore
resticrepositories                                     velero.io/v1                           true         ResticRepository
restores                                               velero.io/v1                           true         Restore
schedules                                              velero.io/v1                           true         Schedule
serverstatusrequests              ssr                  velero.io/v1                           true         ServerStatusRequest
volumesnapshotlocations                                velero.io/v1                           true         VolumeSnapshotLocation
cninodes                          cnd                  vpcresources.k8s.aws/v1alpha1          false        CNINode
securitygrouppolicies             sgp                  vpcresources.k8s.aws/v1beta1           true         SecurityGroupPolicy

Related commands[edit]

See also[edit]

Advertising: