[K8S] 쿠버네티스 YAML 파일에 변수 선언, 처리하는 방법

  • huaya
    (후아빠)
  • huaya's Avatar 이 글의 작성자
  • Offline
  • Junior
  • Junior
더보기
18 Oct 2022 13:40 - 13 Dec 2022 07:48 #31957 작성자: huaya
huaya 님의 글: [K8S] 쿠버네티스 YAML 파일에 변수 선언, 처리하는 방법
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:$VER
        ports:
        - containerPort: 80

위 파일이 deployment.yaml 이라고 할 때 $VER 부분을 치환하려면

export VER=0.05
envsubst < deployment.yaml | kubectl apply -f -
Time to create page: 0.048 seconds
Powered by Kunena Forum