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 | 29 | 30 | 31 |
Tags
- JPA
- consumer
- AWS
- topic생성
- Entity
- producer
- ECS
- offsetdatetime
- CodePipeline
- Streams
- centos7
- pgvector
- kafka
- QueryDSL
- cd
- K8s
- Spring Data JPA
- Spring JPA
- API
- PAGING
- spring kafka
- git
- transactionaleventlistener
- Kotlin
- Kubernetes
- entity graph
- bean
- mysql
- CI
- spring
Archives
- Today
- Total
Yebali
Kubernetes의 ConfigMap 본문
ConfigMap은 Key-Value쌍으로 보안에 민감하지 않은 데이터를 저장할 때 사용하는 API 오브젝트이다.
ConfigMap을 사용하면 Container image에서 환경별로 구성을 분리하여, 애플리케이션을 쉽게 의식할 수 있다.
ConfigMap은 암호화를 제공하지 않기 때문에 민감한 데이터는 Secret을 사용해야 한다.
또한, 많은 정보를 보유하도록 설계되지 않았기 때문에 저장된 데이터는 1MiB를 초과할 수 없다.
예시
apiVersion: v1
kind: ConfigMap
metadata:
name: game-demo
data:
# 속성과 비슷한 키; 각 키는 간단한 값으로 매핑됨
player_initial_lives: "3"
ui_properties_file_name: "user-interface.properties"
# 파일과 비슷한 키
game.properties: |
enemy.types=aliens,monsters
player.maximum-lives=5
user-interface.properties: |
color.good=purple
color.bad=yellow
allow.textmode=true
apiVersion: v1
kind: Pod
metadata:
name: configmap-demo-pod
spec:
containers:
- name: demo
image: alpine
command: ["sleep", "3600"]
env:
# 환경 변수 정의
- name: PLAYER_INITIAL_LIVES # 참고로 여기서는 컨피그맵의 키 이름과
# 대소문자가 다르다.
valueFrom:
configMapKeyRef:
name: game-demo # 이 값의 컨피그맵.
key: player_initial_lives # 가져올 키.
- name: UI_PROPERTIES_FILE_NAME
valueFrom:
configMapKeyRef:
name: game-demo
key: ui_properties_file_name
volumeMounts:
- name: config
mountPath: "/config"
readOnly: true
volumes:
# 파드 레벨에서 볼륨을 설정한 다음, 해당 파드 내의 컨테이너에 마운트한다.
- name: config
configMap:
# 마운트하려는 컨피그맵의 이름을 제공한다.
name: game-demo
# 컨피그맵에서 파일로 생성할 키 배열
items:
- key: "game.properties"
path: "game.properties"
- key: "user-interface.properties"
path: "user-interface.properties"'Backend Common' 카테고리의 다른 글
| pgvector 톺아보기 (0) | 2025.12.29 |
|---|---|
| Ubuntu와 RHEL에 Docker 설치하기 (On-Premise 환경 기준) (0) | 2025.06.03 |
| Kubernetes의 Ingress (0) | 2024.03.16 |
| Kubernetes의 kube-proxy (0) | 2024.03.04 |
| Kubernetes의 Service (0) | 2024.03.03 |