赞
踩
最近在学习k8s的相关知识,嗯,出现一些问题,记录下。
Docker 20.10.12
kubeadm-v1.23.4
kubelet-v1.23.4
kubectl-v1.23.4
对,需要对volume,pv,pvc有了解哈
在使用nfs持久化存储这块出现的问题
nfs的k8s持久化存储的插件:https://github.com/kubernetes-retired/external-storage/tree/master/nfs
在创建pvc报的错
kubectl apply -f my-pvc.yaml
kubectl get pvc
这块有一些问题,就是
[root@k8sm storage]# kubectl describe pvc Name: my-pvc Namespace: default StorageClass: example-nfs Status: Pending Volume: Labels: <none> Annotations: control-plane.alpha.kubernetes.io/leader: {"holderIdentity":"7c4527be-a9ea-11ec-93ce-3a41d59f9259","leaseDurationSeconds":15,"acquireTime":"2022-03-22T14:30:27Z","renewTime":"2022-... volume.beta.kubernetes.io/storage-class: example-nfs volume.beta.kubernetes.io/storage-provisioner: example.com/nfs volume.kubernetes.io/storage-provisioner: example.com/nfs Finalizers: [kubernetes.io/pvc-protection] Capacity: Access Modes: VolumeMode: Filesystem Used By: <none> Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ExternalProvisioning 11s (x21 over 43s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "example.com/nfs" or manually created by system administrator
Normal ExternalProvisioning 11s (x21 over 43s) persistentvolume-controller waiting for a volume to be created, either by external provisioner “example.com/nfs” or manually created by system administrator
一直都在pending状态
去查了一下,解决方式:
修改apiserver的配置
[root@k8sm storage]# vi /etc/kubernetes/manifests/kube-apiserver.yaml
apiVersion: v1
···
- --tls-private-key-file=/etc/kubernetes/pki/apiserver.key
- --feature-gates=RemoveSelfLink=false # 添加这个配置
重启下kube-apiserver.yaml
[root@k8sm manifests]# kubectl apply -f kube-apiserver.yaml
[root@k8sm storage]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
my-pvc Bound pvc-ae9f6d4b-fc4c-4e19-8854-7bfa259a3a04 1Mi RWX example-nfs 13m
就正常了,查了下为什么?
因为原来是1.20版本(我的是1.23.4)默认禁止使用selfLink。
哦,那啥事selfLink?
selfLink:通过API访问资源自身的URL,例如一个Pod的link可能是/api/v1/namespaces/ns36aa8455/pods/sc-cluster-test-1-6bc58d44d6-r8hld
额,到这把。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。