kubectl get --show-labels

1 개요[ | ]

kubectl get --show-labels
  • kubectl get 명령어에서 리소스를 조회할 때, 각 리소스에 설정된 레이블을 함께 출력한다.
  • 기본적으로 kubectl get은 NAME, READY, STATUS, AGE 등 주요 필드만 보여주지만, --show-labels 플래그를 사용하면 레이블 정보를 추가 열로 확인할 수 있다.
  • kubectl describe-o json 옵션과 달리, 간단히 테이블 형태로 레이블을 열람할 때 유용하다.

2 실행 예시[ | ]

$ kubectl get nodes --show-labels
NAME           STATUS   ROLES           AGE   VERSION   LABELS
controlplane   Ready    control-plane   18d   v1.33.2   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=controlplane,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
node01         Ready    <none>          17d   v1.33.2   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=node01,kubernetes.io/os=linux
$ kubectl get pods --show-labels -A
NAMESPACE            NAME                                      READY   STATUS    RESTARTS      AGE   LABELS
kube-system          calico-kube-controllers-fdf5f5495-8jbqm   1/1     Running   2 (12m ago)   18d   k8s-app=calico-kube-controllers,pod-template-hash=fdf5f5495
kube-system          canal-5q8x5                               2/2     Running   2 (12m ago)   17d   controller-revision-hash=7d8c9cfdb6,k8s-app=canal,pod-template-generation=1
kube-system          canal-hvvtk                               2/2     Running   2 (12m ago)   17d   controller-revision-hash=7d8c9cfdb6,k8s-app=canal,pod-template-generation=1
kube-system          coredns-6ff97d97f9-gq4nd                  1/1     Running   1 (12m ago)   17d   k8s-app=kube-dns,pod-template-hash=6ff97d97f9
kube-system          coredns-6ff97d97f9-hcn7j                  1/1     Running   1 (12m ago)   17d   k8s-app=kube-dns,pod-template-hash=6ff97d97f9
kube-system          etcd-controlplane                         1/1     Running   2 (12m ago)   18d   component=etcd,tier=control-plane
kube-system          kube-apiserver-controlplane               1/1     Running   2 (12m ago)   18d   component=kube-apiserver,tier=control-plane
kube-system          kube-controller-manager-controlplane      1/1     Running   2 (12m ago)   18d   component=kube-controller-manager,tier=control-plane
kube-system          kube-proxy-7kdz8                          1/1     Running   2 (12m ago)   18d   controller-revision-hash=7f964d48ff,k8s-app=kube-proxy,pod-template-generation=1
kube-system          kube-proxy-lg8cx                          1/1     Running   1 (12m ago)   17d   controller-revision-hash=7f964d48ff,k8s-app=kube-proxy,pod-template-generation=1
kube-system          kube-scheduler-controlplane               1/1     Running   2 (12m ago)   18d   component=kube-scheduler,tier=control-plane
local-path-storage   local-path-provisioner-5c94487ccb-gmwjg   1/1     Running   2 (12m ago)   18d   app=local-path-provisioner,pod-template-hash=5c94487ccb

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}