Multus-cleanup sometimes fails to start if /var/lib/cni/multus does not exist on the host

Issue observed in !5350 (merged)

Summary

kubectl describe daemonset -n kube-system multus-cleanup
Name:           multus-cleanup
Selector:       app=multus-cleanup
Node-Selector:  <none>
Labels:         kustomize.toolkit.fluxcd.io/name=multus-cleanup
                kustomize.toolkit.fluxcd.io/namespace=rke2-capm3-virt
Annotations:    deprecated.daemonset.template.generation: 1
Desired Number of Nodes Scheduled: 4
Current Number of Nodes Scheduled: 4
Number of Nodes Scheduled with Up-to-date Pods: 4
Number of Nodes Scheduled with Available Pods: 3
Number of Nodes Misscheduled: 0
Pods Status:  3 Running / 1 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:           app=multus-cleanup
  Service Account:  multus
  Containers:
   multus-cleanup:
    Image:      registry.gitlab.com/sylva-projects/sylva-elements/container-images/kube-job:v1.3.0
    Port:       <none>
    Host Port:  <none>
    Command:
      bash
      -c
      set -e
      while true; do
        /opt/multus-cleanup.sh
        sleep ${INTERVAL:-3600}
      done

    Limits:
      cpu:                1
      ephemeral-storage:  16Mi
      memory:             256Mi
    Requests:
      cpu:                0
      ephemeral-storage:  0
      memory:             0
    Environment:
      MULTUS_VAR_DIR:  /host/var/lib/cni/multus
    Mounts:
      /host/var/lib/cni/multus from host-multus-dir (rw)
      /opt/ from script-volume (rw)
  Volumes:
   script-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      multus-cleanup-scripts-cdk8k6572h
    Optional:  false
   host-multus-dir:
    Type:          HostPath (bare host directory volume)
    Path:          /var/lib/cni/multus
    HostPathType:  Directory
  Node-Selectors:  <none>
  Tolerations:     <none>
Events:
  Type     Reason       Age                 From     Message
  ----     ------       ----                ----     -------
  Warning  FailedMount  10h (x45 over 12h)  kubelet  MountVolume.SetUp failed for volume "host-multus-dir" : hostPath type check failed: /var/lib/cni/multus is not a directory

Possible fixes

Switch the hostPathType to DirectoryOrCreate

Assignee Loading
Time tracking Loading