見出し画像

kubernetes APIリソース一覧とショートネームについて


LinuCエヴァンジェリストの鯨井貴博@opensourcetechです。


はじめに


kubernetesでkubectlのコマンド入力を省略形(ショートネーム)で行っている方をみかけたので、
ちょっと調べてみました。

例えば、以下のような使い方です。

kubeuser@kubemaster1:~$ kubectl get po
NAME                      READY   STATUS    RESTARTS   AGE
nginx-6c67f5ff6f-5vbvf    1/1     Running   0          6d7h
nginx-6c67f5ff6f-lfl8l    1/1     Running   0          6d7h
nginx2-589cdbd4b8-6c848   1/1     Running   0          2d20h
nginx2-589cdbd4b8-sgq8b   1/1     Running   0          2d21h

kubeuser@kubemaster1:~$ kubectl get pods
NAME                      READY   STATUS    RESTARTS   AGE
nginx-6c67f5ff6f-5vbvf    1/1     Running   0          6d7h
nginx-6c67f5ff6f-lfl8l    1/1     Running   0          6d7h
nginx2-589cdbd4b8-6c848   1/1     Running   0          2d20h
nginx2-589cdbd4b8-sgq8b   1/1     Running   0          2d21h



ショートネーム


"pods"を略して"po"、
"endpoints"を略して"ep"。

これは、ショートネームという表記方法です。



APIリソースとショートネームの一覧


APIリソースとショートネームの一覧ですが、"kubectl api-resources"で確認できます。

kubeuser@kubemaster1:~$ 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
bgpconfigurations                              crd.projectcalico.org          false        BGPConfiguration
bgppeers                                       crd.projectcalico.org          false        BGPPeer
blockaffinities                                crd.projectcalico.org          false        BlockAffinity
caliconodestatuses                             crd.projectcalico.org          false        CalicoNodeStatus
clusterinformations                            crd.projectcalico.org          false        ClusterInformation
felixconfigurations                            crd.projectcalico.org          false        FelixConfiguration
globalnetworkpolicies                          crd.projectcalico.org          false        GlobalNetworkPolicy
globalnetworksets                              crd.projectcalico.org          false        GlobalNetworkSet
hostendpoints                                  crd.projectcalico.org          false        HostEndpoint
ipamblocks                                     crd.projectcalico.org          false        IPAMBlock
ipamconfigs                                    crd.projectcalico.org          false        IPAMConfig
ipamhandles                                    crd.projectcalico.org          false        IPAMHandle
ippools                                        crd.projectcalico.org          false        IPPool
ipreservations                                 crd.projectcalico.org          false        IPReservation
kubecontrollersconfigurations                  crd.projectcalico.org          false        KubeControllersConfiguration
networkpolicies                                crd.projectcalico.org          true         NetworkPolicy
networksets                                    crd.projectcalico.org          true         NetworkSet
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
catalogsources                    catsrc       operators.coreos.com           true         CatalogSource
clusterserviceversions            csv,csvs     operators.coreos.com           true         ClusterServiceVersion
installplans                      ip           operators.coreos.com           true         InstallPlan
operatorconditions                condition    operators.coreos.com           true         OperatorCondition
operatorgroups                    og           operators.coreos.com           true         OperatorGroup
operators                                      operators.coreos.com           false        Operator
subscriptions                     sub,subs     operators.coreos.com           true         Subscription
poddisruptionbudgets              pdb          policy                         true         PodDisruptionBudget
podsecuritypolicies               psp          policy                         false        PodSecurityPolicy
viziers                                        px.dev                         true         Vizier
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


kubernetesの公式ドキュメントにも、情報はあります。
https://kubernetes.io/docs/reference/kubectl/overview/#resource-types



おわりに



たいしたことではないのですが、
こういう小ネタを知っているか知らないかで操作スピードも速くなるし、
ちょっとkubernetesに詳しい人感を出せていいですねw
※そうじゃねえだろうwww

この記事が気に入ったらサポートをしてみませんか?