Kubernetes master不附加FlexVolume

问题描述 投票:5回答:1

我正在尝试将dummy-attachable FlexVolume sample附加到Kubernetes,它似乎根据我在节点和主节点上的日志正常初始化:

Loaded volume plugin "flexvolume-k8s/dummy-attachable

但是当我尝试将卷附加到pod时,绝不会从主服务器调用attach方法。来自节点的日志读取:

flexVolume driver k8s/dummy-attachable: using default GetVolumeName for volume dummy-attachable
operationExecutor.VerifyControllerAttachedVolume started for volume "dummy-attachable"
Operation for "\"flexvolume-k8s/dummy-attachable/dummy-attachable\"" failed. No retries permitted until 2019-04-22 13:42:51.21390334 +0000 UTC m=+4814.674525788 (durationBeforeRetry 500ms). Error: "Volume has not been added to the list of VolumesInUse in the node's volume status for volume \"dummy-attachable\" (UniqueName: \"flexvolume-k8s/dummy-attachable/dummy-attachable\") pod \"nginx-dummy-attachable\"

这是我试图安装卷的方式:

apiVersion: v1
kind: Pod
metadata:
  name: nginx-dummy-attachable
  namespace: default
spec:
  containers:
    - name: nginx-dummy-attachable
      image: nginx
      volumeMounts:
        - name: dummy-attachable
          mountPath: /data
      ports:
        - containerPort: 80
  volumes:
    - name: dummy-attachable
      flexVolume:
        driver: "k8s/dummy-attachable"

这是qazxsw poi的输出:

kubectl describe pod nginx-dummy-attachable

我将调试日志记录添加到FlexVolume,因此我能够验证从未在主节点上调用attach方法。我不确定我在这里缺少什么。

我不知道这是否重要,但群集正在与KOPS一起发布。我试过k8s 1.11和1.14都没有成功。

kubernetes kops
1个回答
5
投票

所以这很有趣。

即使kubelet在master上初始化FlexVolume插件,kube-controller-manager也是KOP中的容器化,实际上负责将卷附加到pod的应用程序。 KOP没有将默认插件目录Name: nginx-dummy-attachable Namespace: default Priority: 0 PriorityClassName: <none> Node: [node id] Start Time: Wed, 24 Apr 2019 08:03:21 -0400 Labels: <none> Annotations: kubernetes.io/limit-ranger: LimitRanger plugin set: cpu request for container nginx-dummy-attachable Status: Pending IP: Containers: nginx-dummy-attachable: Container ID: Image: nginx Image ID: Port: 80/TCP Host Port: 0/TCP State: Waiting Reason: ContainerCreating Ready: False Restart Count: 0 Requests: cpu: 100m Environment: <none> Mounts: /data from dummy-attachable (rw) /var/run/secrets/kubernetes.io/serviceaccount from default-token-hcnhj (ro) Conditions: Type Status Initialized True Ready False ContainersReady False PodScheduled True Volumes: dummy-attachable: Type: FlexVolume (a generic volume resource that is provisioned/attached using an exec based plugin) Driver: k8s/dummy-attachable FSType: SecretRef: nil ReadOnly: false Options: map[] default-token-hcnhj: Type: Secret (a volume populated by a Secret) SecretName: default-token-hcnhj Optional: false QoS Class: Burstable Node-Selectors: <none> Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s node.kubernetes.io/unreachable:NoExecute for 300s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedMount 41s (x6 over 11m) kubelet, [node id] Unable to mount volumes for pod "nginx-dummy-attachable_default([id])": timeout expired waiting for volumes to attach or mount for pod "default"/"nginx-dummy-attachable". list of unmounted volumes=[dummy-attachable]. list of unattached volumes=[dummy-attachable default-token-hcnhj] 挂载到kube-controller-manager pod,因此它对master上的FlexVolume插件一无所知。

除了在KOP解决此问题之前使用不同的Kubernetes部署工具之外,似乎没有非hacky方法。

© www.soinside.com 2019 - 2024. All rights reserved.