通过环境变量方式使用ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: appvar
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: pod-test
spec:
containers:
- name: test
image: busybox
command: [ "/bin/sh", "-c", "env" ]
envFrom:
- configMapRef:
name: appvar
restartPolicy: Never
[root@master Chapter9]# kc get configmap
NAME DATA AGE
special-config 2