我有两个不同的配置映射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"
我不确定合并两个配置图是否可以实现.如果是,那么我该怎么办呢.