 PV

 使用nfs
 ```
 yum install -y nfs-utils
 # 查看是否安装
cat /etc/exports
showmount -e 127.0.0.1
systemctl start rpcbind
systemctl enable rpcbind
systemctl status rpcbind

mkdir /data/nfs
mount -f nfs 10.0.0.245:/data/nfs /data/nfs
 ```
编辑pv.yml

![pv.yml](img/pvQQ截图20231012222434.png)

pvc

![pvc](img/pvcQQ截图20231012223858.png)


deployment
```
apiVersion: v1
kind: Deployment
metadata:
  name: dp-pvc
  namespace: kube-test
  labels:
    app: dp-pvc
spec:
  selector:
    matchLabels:
      app: dp-pvc
  template:
    metadata:
      labels:
        app: dp-pvc
    spec:
      containers:
      - name :dp-pvc
        image: harbor.captain.com/captain/nginx:1.19.8-alpine
        ports:
        - containerPort: 80
        volumeMounts:
        - name: dp-pvc
          mountPath: /usr/share/nginx/html
    volumes:
    - name: dp-pvc
      persistentVolumeClaim:
        claimName: pvc

```

service
```
apiVersion: v1
kind: Service
metadata: 
  name: dp-pvc
  namespace: kube-system
  labels:
    app: dp-pvc
spec:
  # type: ClusterIP
  selector:
    app: volume
  # clusterIP:
  ports:
    - name: dp-pvc
      protocol: TCP
      port: 80
      targetPort: 80
```

ingress

```
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx
  namespace: kube-system
  labels:
    app: nginx
spec:
  rules:
  - host:
    http:
      paths:
      - path: /
        backend:
          serviceName:
          servicePort:
```