我有一个从文件创建出来的configMap
:
kubectl create configmap ssportal-apache-conf --from-file=ssportal.conf=ssportal.conf
然后我需要将这个文件挂载到部署中:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ssportal
spec:
replicas: 2
template:
metadata:
labels:
app: ssportal
spec:
containers:
- name: ssportal
image: eu.gcr.io/my-project/ssportal:0.0.0
ports:
- containerPort: 80
volumeMounts:
- name: apache2-config-volume
mountPath: /etc/apache2/
volumes:
- name: apache2-config-volume
configMap:
name: ssportal-apache-conf
items:
- key: ssportal.conf
path: sites-enabled/ssportal.conf
但这实际上从容器中移除了现有的/etc/apache2/
目录,并用一个唯一文件/etc/apache2/sites-enabled/ssportal.conf
替换它。
是否可能只覆盖现有配置目录中的一个文件?
kubectl create configmap sstest --from-file=test.conf
就足以创建配置映射。 - c0degeas