이전 예제와 같이 코드에서 컨피그맵의 데이터를 환경 변수로 가져오는 것 대신 쿠버네티스 특
수 문법인
$(
VARIABLE
)
를 사용하면 환경 변수를 명령줄 인자로 가져올 수 있다.
데모 저장소
hello
-
config
-
args
디렉터리의
deployment
.
yaml
예제 파일을 살펴보자.
spec:
containers:
- name: demo
image: cloudnatived/demo:hello-config-args
args:
-
"-greeting"
-
"$(GREETING)"
ports:
- containerPort: 8888
env:
- name: GREETING
valueFrom:
configMapKeyRef:
name: demo-config
key: greeting
컨테이너 스펙에
args
필드를 추가하여 사용자 지정 인수를 컨테이너의 기본 엔트리포인트인
/
bin
/
demo
로 전달한다.
쿠버네티스는 매니페스트에서
$(
VARIABLE
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.