출처 : https://kubernetes.io/docs/reference/kubectl/cheatsheet/
ㅁ Pod/Deploy 사용중인 이미지 조회 ( Pod/Deploy's image tag)
## Pod별
kubectl get pod -n kube-system -o=custom-columns=podname:metadata.name,namespace:metadata.namespace,image:spec.containers..image
## deploy 별
#여러줄
kubectl get deploy -n kube-system --no-headers -o=custom-columns\
=deployname:metadata.name,name-space:metadata.namespace,\
image:.spec.template..spec.containers..image
## deploy 별
#한줄
kubectl get deploy -n kube-system --no-headers -o=custom-columns=deployname:metadata.name,name-space:metadata.namespace,image:.spec.template..spec.containers..image
## daemonset
ㅁ Header 제거 ( no-headers)
kubectl get ns --output=custom-columns=:.metadata.name --no-headers
ㅁ pod 시작시간 정렬 (sort by pod's startTime)
kubectl get pod -A --sort-by=.status.startTime
ㅁ node,ip hostname ( k8s nodes' ip/hostname)
kubectl get nodes -o jsonpath='{.items[*].status.addresses[*].address}'
ㅁ secret의 base64 decode
kubectl -n kubernetes-dashboard get secret dashboard-admin-secret -o go-template="{{.data.token | base64decode}}"
'클라우드 > K8S' 카테고리의 다른 글
helm 명령어 (0) | 2023.01.02 |
---|---|
[system log]failed to get system container stats (0) | 2022.12.19 |
[k8s] orphaned pod 조치 (0) | 2022.12.16 |
[k8s]Node Drain (0) | 2021.09.14 |
kubectl custom column 사용 (0) | 2021.07.01 |