csi-driver icon indicating copy to clipboard operation
csi-driver copied to clipboard

Can't mount a volume to a newly joined node

Open ostretsov opened this issue 7 years ago • 1 comments

Hi,

I created a simple cluster on hetzner.cloud with only 3 nodes (one master and two workers). I deployed several simple tools (Grafana, Prometheus, simple Go app, PostgreSQL) and all of them used automatically mounted volumes based on rules defined in corresponding PersistentVolumeClaims files. Each node in the cluster has attachable-volumes-csi-csi.hetzner.cloud attribute.

$ kubectl describe nodes k8s-n01 | grep attachable-volumes-csi-csi.hetzner.cloud
 attachable-volumes-csi-csi.hetzner.cloud:  16
 attachable-volumes-csi-csi.hetzner.cloud:  16
  attachable-volumes-csi-csi.hetzner.cloud  0          0

After a while, I joined new node k8s-n03:

$ kubectl get nodes
NAME      STATUS   ROLES    AGE    VERSION
k8s-m1    Ready    master   7d7h   v1.15.3
k8s-n01   Ready    <none>   7d7h   v1.15.3
k8s-n02   Ready    <none>   7d7h   v1.15.3
k8s-n03   Ready    <none>   13m    v1.16.0

$ kubectl get pods -A -o wide | grep k8s-n03
kube-system             hcloud-csi-node-6lr5l                       2/2     Running   0          14m     116.203.137.200   k8s-n03   <none>           <none>
kube-system             kube-proxy-ffdpt                            1/1     Running   0          14m     116.203.137.200   k8s-n03   <none>           <none>
kube-system             node-exporter-z4g8x                         1/1     Running   0          14m     116.203.137.200   k8s-n03   <none>           <none>
kube-system             weave-net-vqrrm                             2/2     Running   0          14m     116.203.137.200   k8s-n03   <none>           <none>

On that node there is no lines with attachable-volumes-csi-csi.hetzner.cloud attribute:

$ kubectl describe nodes k8s-n03 | grep attachable-volumes-csi-csi.hetzner.cloud
$ 

On that node mounting of a volume doesn't work. I labeled this node and added nodeSelector attribute in a pod specification from the README.md example and got the following error (last lines):

$ kubectl label nodes k8s-n03 app=mount-error

$ cat test.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: csi-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: hcloud-volumes
---
kind: Pod
apiVersion: v1
metadata:
  name: my-csi-app
spec:
  nodeSelector:
    app: mount-error
  containers:
    - name: my-frontend
      image: busybox
      volumeMounts:
        - mountPath: "/data"
          name: my-csi-volume
      command: [ "sleep", "1000000" ]
  volumes:
    - name: my-csi-volume
      persistentVolumeClaim:
        claimName: csi-pvc

$ kubectl apply -f test.yaml
persistentvolumeclaim/csi-pvc created
pod/my-csi-app created

$ kubectl describe pods my-csi-app
Name:               my-csi-app
Namespace:          graylog
Priority:           0
PriorityClassName:  <none>
Node:               k8s-n03/116.203.137.200
Start Time:         Fri, 20 Sep 2019 17:08:49 +0300
Labels:             <none>
Annotations:        kubectl.kubernetes.io/last-applied-configuration:
                      {"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"my-csi-app","namespace":"graylog"},"spec":{"containers":[{"command":[...
Status:             Pending
IP:                 
Containers:
  my-frontend:
    Container ID:  
    Image:         busybox
    Image ID:      
    Port:          <none>
    Host Port:     <none>
    Command:
      sleep
      1000000
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /data from my-csi-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-tfnxq (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  my-csi-volume:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  csi-pvc
    ReadOnly:   false
  default-token-tfnxq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-tfnxq
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  app=mount-error
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason                  Age               From                     Message
  ----     ------                  ----              ----                     -------
  Normal   Scheduled               52s               default-scheduler        Successfully assigned graylog/my-csi-app to k8s-n03
  Normal   SuccessfulAttachVolume  49s               attachdetach-controller  AttachVolume.Attach succeeded for volume "pvc-1874dee9-9e16-45b0-ad8b-82ed5ccb8a23"
  Warning  FailedMount             4s (x7 over 36s)  kubelet, k8s-n03         MountVolume.NewMounter initialization failed for volume "pvc-1874dee9-9e16-45b0-ad8b-82ed5ccb8a23" : volume mode "Persistent" not supported by driver csi.hetzner.cloud (only supports [])

I tried to kubeadm reset and kubeadm join ... but with no luck. Any help? Thanks.

ostretsov avatar Sep 20 '19 14:09 ostretsov

Finally, I've solved the problem:

  1. downgraded kube[adm|let|ctl] version on the new node to v1.15.3 (same as on other nodes);
  2. deleted StatefulSet and DaemonSet:
$ kubectl delete statefulset -n kube-system hcloud-csi-controller
$ kubectl delete daemonset -n kube-system hcloud-csi-node
  1. created them again:
$ kubectl apply -f https://raw.githubusercontent.com/hetznercloud/csi-driver/master/deploy/kubernetes/hcloud-csi.yml

I suppose it might be great to mention version restrictions in README.md.

ostretsov avatar Sep 21 '19 16:09 ostretsov