k8s之pod多个挂载点写法

docker run -p 80:80 --name mynginx -v $PWD/www:/www -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf -v $PWD/logs:/wwwlogs -d nginx

cat nginx-pod.yaml

apiVersion: v1
kind: Pod
metadata:
 name: nginx-pod
 labels:
  name: nginx-pod
spec:
 containers:
 - name: nginx
   image: nginx
   volumeMounts:
   - mountPath: /www
     name: www
   - mountPath: /etc/nginx/nginx.conf
     name: conf
   - mountPath: /wwwlogs
     name: logs
   ports:
   - containerPort: 80
 volumes:
 - name: www
   hostPath: 
     path: "/root/nginx/www"
 - name: conf
   hostPath:
     path: "/root/nginx/conf/nginx.conf"
 - name: logs
   hostPath:
     path: "/root/nginx/logs"

猜你喜欢

转载自blog.51cto.com/204222/2161752