"Kubectl Label로 Pod 이름 얻기"의 두 판 사이의 차이

 
36번째 줄: 36번째 줄:
==같이 보기==
==같이 보기==
* [[kubectl get pod]]
* [[kubectl get pod]]
* [[쿠버네티스 Pod]]
* [[쿠버네티스 Label]]


==참고==
==참고==

2019년 6월 24일 (월) 01:09 기준 최신판

1 개요[ | ]

쿠버네티스 Label로 Pod 이름 얻기
testuser@localhost:~$ kubectl get pod -l app=nginx 
NAME                    READY   STATUS    RESTARTS   AGE
nginx-6dcc986cf5-jw96l   1/1     Running   0          74m
nginx-6dcc986cf5-t74dv   1/1     Running   0          74m
jsonpath
testuser@localhost:~$ kubectl get pod -l app=nginx -o jsonpath="{.items[*].metadata.name}"
nginx-6dcc986cf5-jw96l nginx-6dcc986cf5-t74dv
testuser@localhost:~$ PODS=$(kubectl get pod -l app=nginx -o jsonpath="{.items[*].metadata.name}")
testuser@localhost:~$ echo $PODS
nginx-6dcc986cf5-jw96l nginx-6dcc986cf5-t74dv
custom-columns
testuser@localhost:~$ kubectl get pods -l app=nginx -o custom-columns=:metadata.name

nginx-6dcc986cf5-jw96l
nginx-6dcc986cf5-t74dv
testuser@localhost:~$ PODS=$(kubectl get pods -l app=nginx -o custom-columns=:metadata.name)
testuser@localhost:~$ echo $PODS
nginx-6dcc986cf5-jw96l nginx-6dcc986cf5-t74dv

2 같이 보기[ | ]

3 참고[ | ]

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