直接使用
kind: Deployment
spec:
template:
spec:
containers:
- image: nginx
volumeMounts:
- mountPath: /usr/share/nginx/html
name: data
volumes:
- name: data
nfs:
path: /nfs_root/nginx
server: 192.168.1.2
静态存储
-
pv(persistentVolume)
创建一个pv(使用nfs):
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-nfs
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
nfs:
path: /nfs_root
server: 192.168.1.2
-
pvc(persistentVolumeClaim)
创建一个pvc(使用nfs):
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-nfs
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
storageClassName: ""
</