Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Configmap
- 5호선
- 아파트
- statefulset
- 쿠버네티스
- docker
- 응봉현대아파트
- 천호태영아파트
- 신혼부부아파트
- pod
- 행당역
- 명령어
- 답십리 파크자이
- React Native
- 옥수삼성아파트
- 행당한진아파트
- k8s
- describe-instances
- 미아뉴타운sk북한산아파트
- 2025년정책
- 행당대림아파트
- EC2
- kubectl
- 서버간 파일전송
- 6억이하아파트
- ELB
- 황학동롯데캐슬
- aws cli
- Ansible
- 9억이하
Archives
- Today
- Total
게으름을 위한 부지런한 게으름뱅리' 블로그
[K8S] 애플리케이션 변수 관리 본문
반응형
♬ Yaml 파일에 작성하기
pod의 container안에 env 에 작성
apiVersion: v1
kind: Pod
metadata:
name: envar-demo
labels:
purpose: demonstrate-envars
spec:
containers:
- name: envar-demo-container
image: gcr.io/google-samples/node-hello:1.0
env:
- name: DEMO_GREETING
value: "Hello from the environment"
- name: DEMO_FAREWELL
value: "Such a sweet sorrow"
♬ ConfigMap에 작성하기
♪ configMap 만들기
# test파일 생성
$ echo -n 1234 > test
#configmap 생성
$ kubectl create configmap {map-name} --from-file=test
$ kubectl create configmap my-map --from-file=test
#configmap 확인
$ kubectl get configmap my-map -o yaml
♪ pod.yaml에서 configmap 사용하기
apiVersion: v1
kind: Pod
metadata:
name: envar-demo
labels:
purpose: demonstrate-envars
spec:
containers:
- name: envar-demo-container
image: gcr.io/google-samples/node-hello:1.0
env:
- name: DEMO_GREETING
valueFrom:
configMapKeyRef:
name: my-map
key: test
♪ pod실행하기
$ kubectl create -f pod.yaml
$ kubectl exec -it envar-demo -- /bin/bash
#pod에 접속 후 env 확인
$ printenv DEMO_GREETING
반응형
'IT > K8S' 카테고리의 다른 글
[쿠버네티스 교과서] 파드, 디플로이먼트, 서비스 정리 & 문제 (0) | 2023.12.10 |
---|---|
[K8S] ConfigMap 으로 Volume mount하기 (0) | 2021.11.21 |
[K8S] kubectl 명령어 정리 (0) | 2021.11.15 |
[K8S] rook-ceph 활용하기 (0) | 2021.11.14 |
[K8S] Kubernetes Cluster 구성하기 (0) | 2021.11.14 |
Comments