configmap解决subPath目录覆盖的问题
- k8s
- 2024-08-04
- 54热度
- 0评论
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: demo-nginx
name: demo-nginx
spec:
replicas: 2
selector:
matchLabels:
app: demo-nginx
template:
metadata:
labels:
app: demo-nginx
spec:
containers:
image: nginx
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
name: web
protocol: TCP
volumeMounts:
- mountPath: /etc/nginx/nginx.conf
name: config-volume
subPath: etc/nginx/nginx.conf
volumes:
- name: config-volume
configMap:
name: nginx-conf
defaultMode: 420
items:
- key: nginx.conf
path: etc/nginx/nginx.conf