-
라벨 실습kubernetes 2023. 10. 27. 15:46
1. YAML 파일을 사용하여 app=nginx 레이블을 가진 파드를 생성하라. (hint nginx는 80포트를 사용하고 있다)
2. 8080으로 포트포워딩해서 curl 접속 확인하라
3. app=nginx를 가진 파드를 get하라.
4. get된 파드의 라벨이 app임을 확인하라.
5. app=nginx 라벨을 가진 파드에 team=dev1 라을 추가하라apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
labels:
app: nginx
spec:
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
kubectl create -f nginx-pod.ymlkubectl port-forward nginx-pod 8080:80
kubectl get pod -l app=nginx
kubectl get pod -l app=nginx -L app
kubectl label pod nginx-pod team=dev1
kubectl get pod --show-labels