1. 程式人生 > >快速批量創建k8s pv&pvc

快速批量創建k8s pv&pvc

city 創建 man 2.4 api tor version access sts

快速批量創建nfs pv

for i in {3..6}; do
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv00${i}
spec:
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Recycle
  nfs:
    path: /volume1/harbor/nfs${i}
    server: 192.168.2.4
EOF
done          

快速批量創建nfs pvc

for i in {3..6}; do
cat <<EOF | kubectl delete -f -
kind: PersistentVolumeClaim 
apiVersion: v1 
metadata:  
  name: pvc00${i}-claim 
spec:  
  accessModes:   
    - ReadWriteMany  
  resources:    
    requests:      
      storage: 100Gi
EOF
done

快速批量創建k8s pv&pvc