我有一个configMap从文件创建:
kubectl create configmap ssportal-apache-conf --from-file=ssportal.conf=ssportal.conf
Run Code Online (Sandbox Code Playgroud)
然后我需要将此文件挂载到部署中:
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
Run Code Online (Sandbox Code Playgroud)
但这有效地/etc/apache2/从容器中删除了现有目录,并用一个唯一的文件替换它/etc/apache2/sites-enabled/ssportal.conf.
是否可以在现有配置目录上仅覆盖一个文件?
kubernetes ×1