Skip to Content
쿠버네티스를 활용한 클라우드 네이티브 데브옵스
book

쿠버네티스를 활용한 클라우드 네이티브 데브옵스

by 최경현, 저스틴 도밍거스, 존 어런들
December 2019
Beginner to intermediate
420 pages
8h 34m
Korean
Hanbit Media, Inc.
Content preview from 쿠버네티스를 활용한 클라우드 네이티브 데브옵스
268
쿠버네티스를 활용한 클라우드 네이티브 데브옵스
10.2.1
시크릿을 사용하여 환경 변수 설정하기
시크릿은 컨피그맵과 같이 컨테이너에서 읽을 수 있는 환경 변수에 추가하거나 컨테이너의 파
일 시스템에 파일로 마운트할 수 있다. 다음 예제는 시크릿의 값을 환경 변수로 설정한다.
spec:
containers:
- name: demo
image: cloudnatived/demo:hello-secret-env
ports:
- containerPort: 8888
env:
- name: GREETING
valueFrom:
secretKeyRef:
name:
demo-secret
key:
magicWord
configMapKeyRef
대신에
secretKeyRef
를 사용한 것을 제외하면 시크릿에서 환경 변수
GREETING
을 가져오는 방식은 컨피그맵과 동일하다 (‘
10
.
1
.
2
절 컨피그맵을 사용해 환경 변수
설정하기’ 참조 ).
매니페스트를 적용하기 위해 데모 저장소 디렉터리에서 다음 명령어를 실행한다.
kubectl
apply
-f
hello-secret-env/k8s/
deployment.extensions "demo" configured
secret "demo-secret" created
이전과 같이 웹 브라우저에서 접속 가능하도록 호스트 포트를 디플로이먼트로 ...
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.
Start your free trial

You might also like

쿼커스 쿡북: 쿠버네티스를 위한 네이티브 자바 솔루션

쿼커스 쿡북: 쿠버네티스를 위한 네이티브 자바 솔루션

유동환, 알렉스 소토 부에노, 제이슨 포터

Publisher Resources

ISBN: 9791162248249