在部署nfs-client-provisioner时,deployment.yaml可能不兼容新版本k8s接口,这里粘出新的deployment.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-client-provisioner
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: nfs-client-provisioner
spec:
selector:
matchLabels:
app: nfs-client-provisioner
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: nfs-client-provisioner
spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: quay.io/external_storage/nfs-client-provisioner:latest
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: fuseim.pri/ifs
- name: NFS_SERVER
value: 172.20.4.2
- name: NFS_PATH
value: /nfsdata
volumes:
- name: nfs-client-root
nfs:
server: 172.20.4.2
path: /nfsdata
  • 172.20.4.2是我的nfs服务器IP;
  • /nfsdata是我的nfs服务器上的目录,也是将来存储数据的根目录;

还有需要注意的点是,在1.20~1.21的k8s版本中,这个​​nfs-client-provisioner​​​报错​​selfLink was empty​​,可以通过给APIServer增加以下特性们解决:

--feature-gates=RemoveSelfLink=false

但1.21以上的k8s版本中已经移除了这个特性们设置。

需要使用以下的​​nfs-subdir-external-provisioner-4.0.14​​新版本。

$ wget https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/releases/download/nfs-subdir-external-provisioner-4.0.14/nfs-subdir-external-provisioner-4.0.14.tgz
$ tar -zxf nfs-subdir-external-provisioner-4.0.14.tgz
$ cd nfs-subdir-external-provisioner/
$ helm install -f values.yaml . -n nfs --create-namespace --generate-name

其中用到的​​镜像​​可能拉不下来,可以用我上传到aliyun镜像仓库的镜像:

docker pull registry.cn-hangzhou.aliyuncs.com/smallsoup/nfs-subdir-external-provisioner:v4.0.2


微信公众号【我的小碗汤】,扫左侧码关注,了解更多咨询,更有免费资源供您学习