所以我试图建立一个掌舵图.
在我的模板文件中,我有一个文件,如:
apiVersion: v1
kind: ConfigMap
metadata:
name: config-map
data:
{{ Do something here to load up a set of files | indent 2 }}
Run Code Online (Sandbox Code Playgroud)
我的图表中有另一个目录:configmaps
其中有一组json文件,它们本身将包含模板化变量:
a.json
b.json
c.json
Run Code Online (Sandbox Code Playgroud)
最后,我想在我的图表中确定我可以参考:
volumes:
- name: config-a
configMap:
name: config-map
items:
- key: a.json
path: a.json
Run Code Online (Sandbox Code Playgroud) 我有两个不同的配置映射test-configmap和common-config.我试图将它们安装在同一个位置,但是一个配置图覆盖了另一个.然后我读到subPath并且没有工作.
deploy.yaml
apiVersion: apps/v1beta1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: testing
spec:
replicas: 1
template:
metadata:
name: testing
labels:
app: testing
spec:
containers:
- name: testing-container
image: testing
imagePullPolicy: IfNotPresent
ports:
- containerPort: __PORT__
volumeMounts:
- name: commonconfig-volume
mountPath: /usr/src/app/config/test.config
subPath: test.config
volumes:
- name: commonconfig-volume
configMap:
name: test-configmap
- name: commonconfig-volume
configMap:
name: common-config
Run Code Online (Sandbox Code Playgroud)
错误:
The Deployment "testing" is invalid: spec.template.spec.volumes[1].name: Duplicate value: "commonconfig-volume"
我不确定合并两个配置图是否可以实现.如果是,那么我该怎么办呢.