1. 程式人生 > >k8s之pod多個掛載點寫法

k8s之pod多個掛載點寫法

path yam mes mem data mount docke k8s volumes

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"

k8s之pod多個掛載點寫法