“Nfs-subdir-external-provisioner”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
→‎ins
第3行: 第3行:
 
https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
 
https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
 
<pre>
 
<pre>
 +
1. helm
 +
  helm repo add azure http://mirror.azure.cn/kubernetes/charts/
 +
  999  helm search repo nfs-client-provisioner
 +
1000  helm install nfs-storage azure/nfs-client-provisioner  --set nfs.server=192.168.10.104  --set nfs.path=/data/k8s-pv --set storageClass.name=nfs-storage --set storageClass.defaultClass=true
 +
1007  helm uninstall nfs-client
 +
 +
 +
2. yaml
 +
 
nfs-subdir-external-provisioner-master/deploy# cat  deployment.yaml
 
nfs-subdir-external-provisioner-master/deploy# cat  deployment.yaml
 
apiVersion: apps/v1
 
apiVersion: apps/v1

2024年10月5日 (六) 09:56的版本

ins

下载 https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner

1. helm 
  helm repo add azure http://mirror.azure.cn/kubernetes/charts/
  999  helm search repo nfs-client-provisioner
 1000  helm install nfs-storage azure/nfs-client-provisioner   --set nfs.server=192.168.10.104   --set nfs.path=/data/k8s-pv --set storageClass.name=nfs-storage --set storageClass.defaultClass=true
 1007  helm uninstall nfs-client


2. yaml

nfs-subdir-external-provisioner-master/deploy# cat  deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nfs-client-provisioner
  labels:
    app: nfs-client-provisioner
  # replace with namespace where provisioner is deployed
  namespace: default
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: nfs-client-provisioner
  template:
    metadata:
      labels:
        app: nfs-client-provisioner
    spec:
      serviceAccountName: nfs-client-provisioner
      containers:
        - name: nfs-client-provisioner
          image: registry.cn-hangzhou.aliyuncs.com/evan886/my_k8s_containers:402
          volumeMounts:
            - name: nfs-client-root
              mountPath: /persistentvolumes
          env:
            - name: PROVISIONER_NAME
              value: k8s-sigs.io/nfs-subdir-external-provisioner
            - name: NFS_SERVER
              value: 192.168.10.104
            - name: NFS_PATH
              value: /data/k8s-pv
      volumes:
        - name: nfs-client-root
          nfs:
            server: 192.168.10.104
            path: /data/k8s-pv



kubectl apply   -f  class.yaml  -f deployment.yaml  -f rbac.yaml

trobule

MountVolume.SetUp failed for volume "nfs-client-root" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs 192.168.10.104:/data/k8s-pv /var/lib/kubelet/pods/1b3135d7-32cb-407c-8a2b-b644c9d304e7/volumes/kubernetes.io~nfs/nfs-client-root Output: mount: /var/lib/kubelet/pods/1b3135d7-32cb-407c-8a2b-b644c9d304e7/volumes/kubernetes.io~nfs/nfs-client-root: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

To resolve this issue, install the nfs-client package on the host machine 在节点上安装就好了 搞半天 sudo apt install nfs-common