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

来自linux中国网wiki
跳到导航 跳到搜索
(创建页面,内容为“== <pre> nfs-subdir-external-provisioner-master/deploy# cat deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: nfs-client-provisioner labels:…”)
 
 
(未显示同一用户的6个中间版本)
第1行: 第1行:
==
+
=ins =
 +
下载
 +
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
第51行: 第62行:
  
 
To resolve this issue, install the nfs-client package on the host machine
 
To resolve this issue, install the nfs-client package on the host machine
 +
 
在节点上安装就好了 搞半天   
 
在节点上安装就好了 搞半天   
 +
 
sudo apt install nfs-common
 
sudo apt install nfs-common
 +
 +
<pre>
 +
root@debian11:~# ls /data/k8s-pv/
 +
bak       monitoring-prometheus-data-pvc-97b276a8-a5a2-4dcb-b01e-a2ec4725a8f7 mysql-datadir-2
 +
default-data-mysql-0-pvc-86a2d3b3-3744-4415-a980-9853971ac34e       mynamespace-redis-data-redis-cluster-0-pvc-808f074f-e794-45b4-a007-7bf4f9a76c56 mysql-datadir-3
 +
default-data-mysql-1-pvc-e0424e7e-641c-4b7d-835a-97f550c31ec9       mynamespace-redis-data-redis-cluster-1-pvc-0a80613e-4faf-4641-ba6d-d6f5f1f09cd1 mysql-datadir-4
 +
evan-data-mysql-0-pvc-53a65212-ad48-4007-8f0f-40fbd101eacb       mynamespace-redis-data-redis-cluster-2-pvc-a5f72e25-2e18-4976-9c7c-c7ca755dd5c8 mysql-datadir-5
 +
evan-data-mysql-1-pvc-03950858-d68f-4f83-9273-3795cb9caad0       mynamespace-redis-data-redis-cluster-3-pvc-b5ff0710-324b-4491-86ab-fbf0e8d5c24d mysql-data-mysql-cluster-0-pvc-0b2ddfe5-e2d1-4341-82bd-dbca3e0625b3
 +
evan-data-mysql-2-pvc-f97c3869-b5dd-40d5-a280-fa61707ae1fb       mynamespace-redis-data-redis-cluster-4-pvc-6c23fee6-f1f0-4030-955f-c82484be0ca7 test.txt
 +
monitoring-alertmanager-data-pvc-c20aa161-6b65-484c-9c90-c956364b338c  mynamespace-redis-data-redis-cluster-5-pvc-de0d246b-4c06-4d54-9e1e-8fcf61924bc2
 +
monitoring-grafana-data-pvc-470a5359-d153-49fc-88ae-05d1fc57d704      mysql-datadir-1
 +
 +
</pre>
 +
 +
=references=
 +
 +
[https://www.cnblogs.com/klvchen/p/13234779.html K8s 使用 nfs-client-provisioner]
 +
 +
[https://juejin.cn/post/6912071173413011470  k8s中级篇-Helm安装nfs-client-provisioner ]
 +
 +
[https://juejin.cn/post/7353547774174806031  Helm 安装 nfs-client-provisioner ]
 +
 +
[https://happywzy.top/nfs-client-an-zhuang/ nfs-client安装 ]
  
 
[[category:k8s]]
 
[[category:k8s]]

2024年10月20日 (日) 16:06的最新版本

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

root@debian11:~# ls /data/k8s-pv/
bak								       monitoring-prometheus-data-pvc-97b276a8-a5a2-4dcb-b01e-a2ec4725a8f7		mysql-datadir-2
default-data-mysql-0-pvc-86a2d3b3-3744-4415-a980-9853971ac34e	       mynamespace-redis-data-redis-cluster-0-pvc-808f074f-e794-45b4-a007-7bf4f9a76c56	mysql-datadir-3
default-data-mysql-1-pvc-e0424e7e-641c-4b7d-835a-97f550c31ec9	       mynamespace-redis-data-redis-cluster-1-pvc-0a80613e-4faf-4641-ba6d-d6f5f1f09cd1	mysql-datadir-4
evan-data-mysql-0-pvc-53a65212-ad48-4007-8f0f-40fbd101eacb	       mynamespace-redis-data-redis-cluster-2-pvc-a5f72e25-2e18-4976-9c7c-c7ca755dd5c8	mysql-datadir-5
evan-data-mysql-1-pvc-03950858-d68f-4f83-9273-3795cb9caad0	       mynamespace-redis-data-redis-cluster-3-pvc-b5ff0710-324b-4491-86ab-fbf0e8d5c24d	mysql-data-mysql-cluster-0-pvc-0b2ddfe5-e2d1-4341-82bd-dbca3e0625b3
evan-data-mysql-2-pvc-f97c3869-b5dd-40d5-a280-fa61707ae1fb	       mynamespace-redis-data-redis-cluster-4-pvc-6c23fee6-f1f0-4030-955f-c82484be0ca7	test.txt
monitoring-alertmanager-data-pvc-c20aa161-6b65-484c-9c90-c956364b338c  mynamespace-redis-data-redis-cluster-5-pvc-de0d246b-4c06-4d54-9e1e-8fcf61924bc2
monitoring-grafana-data-pvc-470a5359-d153-49fc-88ae-05d1fc57d704       mysql-datadir-1

references

K8s 使用 nfs-client-provisioner

k8s中级篇-Helm安装nfs-client-provisioner

Helm 安装 nfs-client-provisioner

nfs-client安装