subPath 写法
subPath 写法
volumes:
- name: config
configMap:
name: app-config
containers:
- name: app
volumeMounts:
- name: config
mountPath: /etc/app/app.properties
subPath: app.properties验证与重建
验证与重建
kubectl exec -it web-x -- cat /etc/app/app.properties
kubectl get cm app-config -o jsonpath='{.data.app\.properties}'
kubectl rollout restart deploy/web # 需要新值时重建 PodsubPath 在 Pod 启动时建立映射,之后源键的增删改都不会传播进容器。