openshift使用pv和pvc

  • 创建pv配置文件
  vim t_pv.yml
  ---
  apiVersion: v1
  kind: PersistentVolume
  metadata:
    labels:
      use: fluent-bit-config
    name: fluent-bit-config
  spec:
    accessModes:
    - ReadWriteMany
    capacity:
      storage: 10Mi
    nfs:
      path: /app/data/fluent-bit/config
      server: nfs.vinkdong.com
  • 应用pv文件
  oc apply -f t_pv.yml
  • 查看是否成功创建
  oc get pv
  fluent-bit-config                   10Mi       RWX           Retain          Bound   ...
  • 创建pvc:
  vim t-pvc.yml
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: fluent-bit-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Mi
  selector:
    matchLabels:
      use: fluent-bit-config                     
  • 应用pvc
  oc apply -f t_pvc.yml

VinkDong

open to open