[쿠버네티스 워크로드] 레이블 추가, 생성, 삭제, 필터링 실습

IMKUNYOUNG·2023년 7월 31일
0

쿠버네티스

목록 보기
25/64

v2

imkunyoung@master-1:~$ nano http-go-pod-v2.yaml

http-go-pod-v2.yaml

apiVersion: v1
kind: Pod
metadata:
  name: http-go
  labels:
    environment: production
    createion_method: manual # 파드를 수동으로 만들었음~ 을 나타내는 레이블 추가함
spec:
  containers:
  - name: http-go
    image: gasbugs/http-go
    ports:
    - containerPort: 8080
      protocol: TCP







v1

kubectl delete all --all
kubectl get pod --show-labels
kubectl get pod -L env
kubectl get pod -L creation_method
kubectl label pod http-go test=foo
kubectl label pod http-go test=foo1 --overwrite
kubectl label pod http-go test-
kubectl get pod -l env
kubectl get pod -l '!env'
kubectl get pod -l 'env=prod'
kubectl get pod -l 'env=prod,creation_method=manual'

http-go-pod-v2.yaml


apiVersion: v1
kind: Pod
metadata:
  name: http-go
  labels:
    creation_method: manual
    env: prod
spec:
  containers:
  - name: http-go
    image: gasbugs/http-go
    ports:
    - containerPort: 8080
      protocol: TCP

http-go-pod-v3.yaml

apiVersion: v1
kind: Pod
metadata:
  name: http-go-v3
  labels:
    creation_method: manual-v3
spec:
  containers:
    - name: http-go
      image: gasbugs/http-go
      ports:
        - containerPort: 8080
          protocol: TCP

0개의 댓글