我正在做一些练习,并试图围绕如何编写 yaml 构建。
spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
resources: {}
envFrom:
- configMapRef:
name: anotherone # the name of the config map
dnsPolicy: ClusterFirst
restartPolicy: Never
status: {}
VS
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
resources: {}
env:
- name: option # name of the env variable
valueFrom:
configMapKeyRef:
name: options # name of config map
key: var5 # name of the entity in config map
所以我的问题是:当我在 kubernetes 中构建时,我什么时候使用“-”符号?我确实明白,如果我在字符串之前应用'-',它会使其成为列表中的对象,但我不明白何时需要在 kubernetes 的构建中使用列表。