pv
作者:互联网
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-volume-10m
labels:
type: local
spec:
storageClassName: my-nfs-storage
capacity:
storage: 10m
accessModes:
- ReadWriteOnce
nfs: ## 使用nfs存储系统
server: 10.170.11.8 ## 没type
path: /nfs/data/haha ### abc文件夹提前创建
apiVersion: v1
kind: Pod
metadata:
name: "nginx-pvc-000"
namespace: default
labels:
app: "nginx-pvc-000"
spec:
containers:
- name: nginx-pvc-000
image: "nginx"
ports:
- containerPort: 80
name: http
volumeMounts:
- name: localtime
mountPath: /etc/localtime
- name: html
mountPath: /usr/share/nginx/html
volumes:
- name: localtime
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
- name: html
persistentVolumeClaim:
claimName: nginx-pvc ### 你的申请书的名字
restartPolicy: Always
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-pvc
namespace: default
labels:
app: nginx-pvc
spec:
storageClassName: my-nfs-storage ## 存储类的名字
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 70m
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: MYAPP
# namespace: default
# spec:
# selector:
# app: MYAPP
# type: ClusterIP
# ports:
# - name: MYAPP
# port:
# targetPort:
# protocol: TCP
# nodePort:
标签:pv,name,storage,nginx,pvc,nfs,spec 来源: https://www.cnblogs.com/z-sir/p/16332889.html