background
Use nfs to configure the StorageClass
configuration process:
- Configure ServiceAccount
- Configure nfs-client-provisioner
- Configure StorageClass
- Create pvc
nfs-client-provisioner and StorageClass are created successfully, no error
reported
provision "default/exampleforstorageclass" class "managed-nfs-storage": unexpected error getting claim reference: selfLink was empty, can't make reference
solution
selfLink was empty existed before k8s cluster v1.20, and was deleted after v1.20, you need to /etc/kubernetes/manifests/kube-apiserver.yaml
add `- --feature-gates=RemoveSelfLink=false`` in the added parameter
spec:
containers:
- command:
- kube-apiserver
- --feature-gates=RemoveSelfLink=false
After adding, the cluster deployed with kubeadm will automatically load the deployment pod
kubeadm安装的apiserver是Static Pod,它的配置文件被修改后,立即生效。
Kubelet 会监听该文件的变化,当您修改了 /etc/kubenetes/manifest/kube-apiserver.yaml 文件之后,kubelet 将自动终止原有的 kube-apiserver-{nodename} 的 Pod,并自动创建一个使用了新配置参数的 Pod 作为替代。
如果您有多个 Kubernetes Master 节点,您需要在每一个 Master 节点上都修改该文件,并使各节点上的参数保持一致。
It should be noted here that if the api-server fails to start, it needs to be executed again
kubectl apply -f /etc/kubernetes/manifests/kube-apiserver.yaml
After configuration, use kubectl get pvc
pvc STATUS becomes Bound