场景:挂载 ConfigMap 中的 config.json 到容器 /app/config.json,不影响 /app/ 路径下的其他文件
configMap 配置
apiVersion: v1
kind: ConfigMap
metadata:
name: xxx-config
data:
config.json: |
{
"port": "3000"
}
deployment 配置
apiVersion: apps/v1
kind: Deployment
metadata:
***
spec:
***
template:
spec:
containers:
- name: xxx
***
volumeMounts:
- mountPath: /app/config.json
name: conf
subPath: config.json
volumes:
- name: conf
configMap:
name: xxx-config












网友评论