On the automatic creation of PV in K8S 1.13.1 storageclass

was originally tested on a local test machine, and the environment was tested on a stand-alone version of K8s of 1.9.2. The configuration files are mainly as follows:

provisioner.yml

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: nfs-client-deploy
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: nfs-client-deploy
    spec:
      serviceAccount: nfs-client-provisioner
      containers:
        - name: nfs-client-provisioner
          image: registry.cn-hangzhou.aliyuncs.com/open-ali/nfs-client-provisioner
          volumeMounts:
            - name: nfs-client
              mountPath: /persistentvolumes
          env:
            - name: PROVISIONER_NAME
              value: my-provisioner
            - name: NFS_SERVER
              value: 192.168.163.184
            - name: NFS_PATH
              value: /root/docker
      volumes:
        - name: nfs-client
          nfs:
            server: 192.168.163.184
            path: /root/docker

storageclass.yml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-storage
provisioner: -provisioner

test-claim.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: test-claim
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: nfs-storage
  resources:
    requests:
      storage: 1Mi

the above two files are mainly for creating storageclss, and the last one is mainly for a test.
the current problem is that pvc has always been pending in the cluster of my test environment, as shown in the following figure:

then the corresponding pod is also in pending all the time. Check the hint through describe:
pod has unbound immediate PersistentVolumeClaims (repeated 4 times)
. I don"t know what caused the problem. Previously, OK, asked God for guidance in version 1.9.2.

Mar.28,2022

< H2 > me, too. Have you solved your problem? < / H2 >

problem solved,
troubleshoot errors as follows:
1. Check whether the nfs service is read-only, or whether it cannot be mounted
2.kubectl get pod
nfs-client status
3.kubectl get PersistentVolumeClaim
check whether it is normal. If there are any exceptions, you can use kubectl describe PersistentVolumeClaim/test-claim to check

.

in addition, most of the examples on the Internet are installed in the default namespace.
you can check whether your default namespace is default through kubectl config view

.

problem solved. Check the log because you don't have permission. Please check this example https://yq.aliyun.com/article.

.
Menu