Skip to content

termination-log is not available when mounting /dev in containers #190

Open
@maybe-sybr

Description

@maybe-sybr

I've found that the kubernetes-sigs/sig-storage-local-static-provisioner attempts to mount /dev from the host in its provisioner container, which causes issues when running the daemonset under u7s. Given that there are no reports of this being broken on their issue tracker, I presumed it was an unexpected failure case for u7s rather than them doing the wrong thing (feel free to correct me on this).

It's fairly trivial to work around the issue by setting the terminationMessagePath for the container, although it's not clear to me if this would result in termination messages being lost. See the badness.yaml snippet below and its failure events in describe pod badness:

$ cat badness.yaml
apiVersion: v1
kind: Pod
metadata:
  name: badness
  labels:
    app: badness
spec:
  containers:
  - image: busybox
    name: badness
    command: ["sleep", "infinity"]
    volumeMounts:
      - name: shared-dev
        mountPath: /dev
    #terminationMessagePath: /var/run/termination-log
  volumes:
    - name: shared-dev
      hostPath:
        path: /dev/
$ kubectl apply -f badness.yaml
pod/badness created
$ kubectl describe pod badness
...
Events:
  Type     Reason     Age              From          Message
  ----     ------     ----             ----          -------
  Normal   Scheduled  <unknown>                      Successfully assigned default/user-storage-provisioner-7sn8s to host
  Normal   Pulled     2s (x2 over 2s)  kubelet, host Container image "quay.io/external_storage/local-volume-provisioner:v2.3.4" already present on machine
  Warning  Failed     2s               kubelet, host Error: container create failed: open `/home/user/.local/share/usernetes/containers/storage/overlay/6d3e5e577d2174a25f2947faa0af0b5e68af13bedb662eaaf59068f173640091/merged/termination-log`: No such file or directory
  Warning  Failed     2s               kubelet, host Error: container create failed: open `/home/user/.local/share/usernetes/containers/storage/overlay/273772f44ad6a6e0d55af8b2d3dadb154c734084d4bc82b7f7e4f0cd7e8bda8e/merged/termination-log`: No such file or directory

Uncommenting the terminationMessagePath in badness.yaml makes the pod start happily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions