Kubernetes nfs-subdir-external-provisioner卡在ContainerCreatin



我正在尝试安装一个nfs-client-provisioner并使用它运行mongodb。不幸的是,nfs-client- provider挂在ContainerCreating中,并显示&;Warning FailedMount 3m35s (x13 over 37m) kubelet无法挂载卷:unmounted volumes=[nfs-client-root], unattached volumes=[nfs-client-root]:超时等待条件"。

  • nfs服务器配置在同一台VPS机器(Debian 10)上。
  • 我可以用debian 10从第二个vps上挂载和写入文件。
  • 集群设置为K0s
  • 我有一个错误的舵图和手动安装。

任何帮助都是感激的查看更多信息:

执掌版本:

version.BuildInfo{Version:"v3.8.2", GitCommit:"6e3701edea09e5d55a8ca2aae03a68917630e91b", GitTreeState:"clean", GoVersion:"go1.17.5"}

Kubernetes版本:

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6", GitCommit:"ad3338546da947756e8a88aa6822e9c11e7eac22", GitTreeState:"clean", BuildDate:"2022-04-14T08:49:13Z", GoVersion:"go1.17.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5+k0s", GitCommit:"5ab78974affb1a76f1e5687aaa8b02aeac4380b8", GitTreeState:"clean", BuildDate:"2022-03-24T22:59:27Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}

k0s版本:v1.23.5+k0s.0Worker添加:

token=$(k0s token create --role=worker)
docker run -d --name k0s-worker1 --hostname k0s-worker1 --privileged -v /var/lib/k0s docker.io/k0sproject/k0s:latest k0s worker $token

kubectl get nodes

NAME                   STATUS   ROLES           AGE   VERSION
k0s-worker9            Ready    <none>          42m   v1.23.5+k0s
v2202204173709187201   Ready    control-plane   43m   v1.23.5+k0s

kubectl get sc

NAME                  PROVISIONER                                   RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
managed-nfs-storage   k8s-sigs.io/nfs-subdir-external-provisioner   Delete          Immediate           false                  40m

/ect/出口
/data/nfs-storage *(rw,sync,no_root_squash,no_subtree_check,insecure)

输出命令行k0s kubectl description pod nfs-client- provider -6889579fdb-t7j74

Name:           nfs-client-provisioner-6889579fdb-t7j74
Namespace:      default
Priority:       0
Node:           k0s-worker9/172.17.0.2
Start Time:     Tue, 26 Apr 2022 08:45:49 +0200
Labels:         app=nfs-client-provisioner
pod-template-hash=6889579fdb
Annotations:    kubernetes.io/psp: 00-k0s-privileged
Status:         Pending
IP:
IPs:            <none>
Controlled By:  ReplicaSet/nfs-client-provisioner-6889579fdb
Containers:
nfs-client-provisioner:
Container ID:
Image:          gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.1
Image ID:
Port:           <none>
Host Port:      <none>
State:          Waiting
Reason:       ContainerCreating
Ready:          False
Restart Count:  0
Environment:
PROVISIONER_NAME:  k8s-sigs.io/nfs-subdir-external-provisioner
NFS_SERVER:        47.122.181.39
NFS_PATH:          /data/nfs-storage
Mounts:
/persistentvolumes from nfs-client-root (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lr9tl (ro)
Conditions:
Type              Status
Initialized       True
Ready             False
ContainersReady   False
PodScheduled      True
Volumes:
nfs-client-root:
Type:      NFS (an NFS mount that lasts the lifetime of a pod)
Server:    47.122.181.39
Path:      /data/nfs-storage
ReadOnly:  false
kube-api-access-lr9tl:
Type:                    Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds:  3607
ConfigMapName:           kube-root-ca.crt
ConfigMapOptional:       <nil>
DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type     Reason       Age                  From               Message
----     ------       ----                 ----               -------
Normal   Scheduled    18m                  default-scheduler  Successfully assigned default/nfs-client-provisioner-6889579fdb-t7j74 to k0s-worker9
Warning  FailedMount  2m42s (x6 over 16m)  kubelet            Unable to attach or mount volumes: unmounted volumes=[nfs-client-root], unattached volumes=[nfs-client-root kube-api-access-lr9tl]: timed out waiting for the condition
Warning  FailedMount  24s (x2 over 7m14s)  kubelet            Unable to attach or mount volumes: unmounted volumes=[nfs-client-root], unattached volumes=[kube-api-access-lr9tl nfs-client-root]: timed out waiting for the condition

命令使用helm:

helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner 
--set nfs.server=47.122.181.39 
--set nfs.path=/data/nfs-storage

没有舵的:从https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/v4.0.2/deploy

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

class.yaml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: managed-nfs-storage
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment's env PROVISIONER_NAME'
parameters:
archiveOnDelete: "false"

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: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.1
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: k8s-sigs.io/nfs-subdir-external-provisioner
- name: NFS_SERVER
value: 47.122.181.39
- name: NFS_PATH
value: /data/nfs-storage
volumes:
- name: nfs-client-root
nfs:
server: 47.122.181.39
path: /data/nfs-storage

K0s集群设置:

sudo curl -sSLf https://get.k0s.sh | sudo sh
sudo k0s install controller --enable-worker
sudo k0s start
sudo cp /var/lib/k0s/pki/admin.conf ~/admin.conf
export KUBECONFIG=~/admin.conf
token=$(k0s token create --role=worker)
docker run -d --name k0s-worker9 --hostname k0s-worker9 --privileged -v /var/lib/k0s docker.io/k0sproject/k0s:latest k0s worker $token

你试过了吗:

nfs.mountOptions = {
nfsvers = 4
}

我也使用了这个提供程序。它只适用于nfs4。还要检查NFS服务器的挂载点是否是根服务器。如果您的提供程序已配置并准备好,请尝试重新创建pvc。

相关内容

  • 没有找到相关文章

最新更新