Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified subpath configmap mount fails when container restarts #68211

Closed
juliantaylor opened this issue Sep 4, 2018 · 39 comments · Fixed by #89629
Closed

modified subpath configmap mount fails when container restarts #68211

juliantaylor opened this issue Sep 4, 2018 · 39 comments · Fixed by #89629
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/storage Categorizes an issue or PR as relevant to SIG Storage.

Comments

@juliantaylor
Copy link
Contributor

juliantaylor commented Sep 4, 2018

/kind bug

What happened:
When a container uses a configmap which is mounted with the subPath option, the configmap is changed and then the container (but not the pod) restarts the mounting of the configmap fails:

# mount a single file into a folder with preexisting data
        volumeMounts:
        - name: extra-cfg
          mountPath: /etc/puppetlabs/puppetdb/conf.d/extra.ini
          subPath: extra.ini
# change something in the configmap
kubectl edit extra-cfg
kubectl exec podname kill 1
kubectl describe podname

Warning Failed 5s kubelet, kworker-be-intg-iz2-bap006 Error: failed to start container "puppetdb": Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "rootfs_linux.go:58: mounting \"/var/lib/kubelet/pods/b9ffd644-af98-11e8-a05e-246e96748774/volume-subpaths/extra-cfg/puppetdb/2\" to rootfs \"/var/lib/docker/overlay2/c8790b7f3f690c1ef7a582672e2d153062ff6b4ed1ee21aab1158897310fd3d1/merged\" at \"/var/lib/docker/overlay2/c8790b7f3f690c1ef7a582672e2d153062ff6b4ed1ee21aab1158897310fd3d1/merged/etc/puppetlabs/puppetdb/conf.d/extra.ini\" caused \"no such file or directory\""": unknown

(The pod this happens on consists of multiple containers, I have not tested yet if it also happens in a single container pod.)

One has to delete the pod to fix the problem.

Environment:
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:08:19Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

coreos 1800.7.0
docker 18.03.1

@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. kind/bug Categorizes issue or PR as related to a bug. labels Sep 4, 2018
@juliantaylor juliantaylor changed the title subpath configmap mount fails when container restarts edited subpath configmap mount fails when container restarts Sep 4, 2018
@juliantaylor
Copy link
Contributor Author

minimal example:

---
apiVersion: v1
kind: Pod 
metadata:
  name: test-pod
spec:
  volumes:
  - configMap:
      name: extra-cfg
    name: extra-cfg
  containers:
  - name: test
    image: ubuntu:bionic
    command: ["sleep", "30"]
    resources:
      requests:
        cpu: 100m
    volumeMounts:
      - name: extra-cfg
        mountPath: /etc/extra.ini
        subPath: extra.ini
---
apiVersion: v1
data:
  extra.ini: |
    somedata
kind: ConfigMap
metadata:
  name: extra-cfg

deploy the pod, edit the configmap, wait for the 30 second sleep to complete and the container to restart, the restart will fail with the error above.

@juliantaylor juliantaylor changed the title edited subpath configmap mount fails when container restarts modified subpath configmap mount fails when container restarts Sep 4, 2018
@inish777
Copy link

inish777 commented Sep 4, 2018

I have the same configuration and reproduced this bug

@dims
Copy link
Member

dims commented Sep 4, 2018

/sig storage
/priority important-soon

@k8s-ci-robot k8s-ci-robot added sig/storage Categorizes an issue or PR as relevant to SIG Storage. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 4, 2018
@inish777
Copy link

inish777 commented Sep 4, 2018

Using findmnt on node with test-pod I can see

|-/var/lib/kubelet/pods/3dc49ca4-b046-11e8-978a-0e51a1d2416a/volume-subpaths/extra-cfg/test/0                                             /dev/xvda9[/var/lib/kubelet/pods/3dc49ca4-b046-11e8-978a-0e51a1d2416a/volumes/kubernetes.io~configmap/extra-cfg/..2018_09_04_13_27_17.387923275/extra.ini//deleted]

Updated configmap is actually placed at /var/lib/kubelet/pods/3dc49ca4-b046-11e8-978a-0e51a1d2416a/volumes/kubernetes.io~configmap/extra-cfg/..2018_09_04_13_31_59.038960565/extra.ini

@nikopen
Copy link
Contributor

nikopen commented Oct 1, 2018

Issue is reproducable. k8s 1.9.10, docker 17.12.1-ce

I have found another behaviour when using subPath:

in /var/lib/kubelet/pods/( pod-string ) /, there are two places where the configmap file lives:

  1. in `/volumes/kubernetes.io~configmap/( volumename )/( filename )

  2. in `/volume-subpaths/( volumename )/( podname )/0

  3. is the configmap object as is imported at pod creation time,
    and 2. is the file within the pod that changes if you change it within the pod.

So whether you edit the configmap object OR the file within the pod, and then restart the pod - the two files will be different.

In my repro, I'm editing the file within the container and then kill it. This causes the pod to get stuck in a crashloopbackoff.

While this happens I'm tracking the following for the first occurrence:

overlay2 filesystem:

$ inotifywait -r -m overlay2

16:41:17 overlay2/21931d3d54082ac670e2915e4caad2e9a76ab55952459a240f0bd6f66f90ce15/diff/ CREATE trackmefile

this is the attempt to move the 'trackmefile' (configmap's file with data) to the new container, but here it's empty. it doesn't gets any content, and the directory is deleted after about 15 seconds, when the pod crashloops again.

docker daemon logs:

16:41:17 dockerd[102444]: level=info msg="shim docker-containerd-shim started" address="/containerd-shim/moby/867aa9738669c5c6f4763f8585d195abc6a753c8a43a36d5dd72822eb102151e/shim.sock" debug=false module="containerd/tasks" pid=79610
16:41:17 dockerd[102444]: level=info msg="shim reaped" id=867aa9738669c5c6f4763f8585d195abc6a753c8a43a36d5dd72822eb102151e module="containerd/tasks"
16:41:17 dockerd[102444]: level=error msg="stream copy error: reading from a closed fifo"
16:41:17 dockerd[102444]: level=error msg="stream copy error: reading from a closed fifo"
16:41:18 dockerd[102444]: level=error msg="867aa9738669c5c6f4763f8585d195abc6a753c8a43a36d5dd72822eb102151e cleanup: failed to delete container from containerd: no such container"
16:41:18 dockerd[102444]: level=error msg="Handler for POST /v1.31/containers/867aa9738669c5c6f4763f8585d195abc6a753c8a43a36d5dd72822eb102151e/start returned error: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/var/lib/kubelet/pods/be21f5d6-c587-11e8-a5c1-005056b79850/volume-subpaths/trackmevolume/test4/0\\\" to rootfs \\\"/virtual/docker/overlay2/21931d3d54082ac670e2915e4caad2e9a76ab55952459a240f0bd6f66f90ce15/merged\\\" at \\\"/virtual/docker/overlay2/21931d3d54082ac670e2915e4caad2e9a76ab55952459a240f0bd6f66f90ce15/merged/trackmefile\\\" caused \\\"no such file or directory\\\"\"": unknown"

It tries to mount the file from the subpath directory to overlay2/<longstring>/merged, but only an empty husk is located at overlay2/<longstring>/diff . merged directory doesn't exist.

kubelet daemon logs:

16:41:18 kubelet[800]: E1001 800 remote_runtime.go:209] StartContainer "867aa9738669c5c6f4763f8585d195abc6a753c8a43a36d5dd72822eb102151e" from runtime service failed: rpc error: code = Unknown desc = failed to start container "867aa9738669c5c6f4763f8585d195abc6a753c8a43a36d5dd72822eb102151e": Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "rootfs_linux.go:58: mounting \"/var/lib/kubelet/pods/be21f5d6-c587-11e8-a5c1-005056b79850/volume-subpaths/trackmevolume/test4/0\" to rootfs \"/virtual/docker/overlay2/21931d3d54082ac670e2915e4caad2e9a76ab55952459a240f0bd6f66f90ce15/merged\" at \"/virtual/docker/overlay2/21931d3d54082ac670e2915e4caad2e9a76ab55952459a240f0bd6f66f90ce15/merged/trackmefile\" caused \"no such file or directory\""": unknown

same message is printed for kuberuntime_manager.go:734 , pod_workers.go:186, kuberuntime_manager.go:514

kubelet/pods/( podid )/ filesystem:

$ inotifywait -r -m .

 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ OPEN,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ OPEN,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/ OPEN,ISDIR ..2018_10_01_14_39_04.003765758
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ OPEN,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ CLOSE_NOWRITE,CLOSE,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ CLOSE_NOWRITE,CLOSE,ISDIR 
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/ ACCESS,ISDIR ..2018_10_01_14_39_04.003765758
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ OPEN trackmefile
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/ ACCESS,ISDIR ..2018_10_01_14_39_04.003765758
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/ CLOSE_NOWRITE,CLOSE,ISDIR ..2018_10_01_14_39_04.003765758
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ CLOSE_NOWRITE,CLOSE,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ ACCESS trackmefile
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ CLOSE_NOWRITE,CLOSE trackmefile
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ OPEN namespace
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ ACCESS namespace
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ CLOSE_NOWRITE,CLOSE namespace
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ OPEN token
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ CREATE,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ATTRIB,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ ACCESS token
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ CLOSE_NOWRITE,CLOSE token
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ OPEN ca.crt
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ ACCESS ca.crt
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ OPEN,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:15  ./volumes/kubernetes.io~secret/default-token-rghx6/..2018_10_01_14_39_04.003765758/ CLOSE_NOWRITE,CLOSE ca.crt
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ CREATE ..data_tmp
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ CLOSE_NOWRITE,CLOSE,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ MOVED_FROM ..data_tmp
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ MOVED_TO ..data
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ OPEN,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ OPEN,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ DELETE trackmefile
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ ACCESS,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ CLOSE_NOWRITE,CLOSE,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_39_03.227338331/ CLOSE_NOWRITE,CLOSE,ISDIR 
 16:41:15  ./volumes/kubernetes.io~configmap/trackmevolume/ DELETE,ISDIR ..2018_10_01_14_39_03.227338331
 16:41:16  ./containers/test4/ OPEN 1402258e
 16:41:16  ./containers/test4/ CLOSE_NOWRITE,CLOSE 1402258e
 16:41:17  ./ MODIFY etc-hosts
 16:41:17  ./ OPEN etc-hosts
 16:41:17  ./ MODIFY etc-hosts
 16:41:17  ./ CLOSE_WRITE,CLOSE etc-hosts
 16:41:17  ./containers/test4/ CREATE 5bc2fca2
 16:41:17  ./containers/test4/ OPEN 5bc2fca2
 16:41:17  ./containers/test4/ CLOSE_WRITE,CLOSE 5bc2fca2
 16:41:17  ./containers/test4/ ATTRIB 5bc2fca2
 16:41:18  ./containers/test4/ OPEN 5bc2fca2
 16:41:18  ./containers/test4/ CLOSE_NOWRITE,CLOSE 5bc2fca2
 16:41:18  ./containers/test4/ OPEN 1402258e
 16:41:18  ./containers/test4/ CLOSE_NOWRITE,CLOSE 1402258e
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/ OPEN,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_41_15.703606290/ OPEN,ISDIR 
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_41_15.703606290/ ACCESS,ISDIR 
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/ ACCESS,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_41_15.703606290/ ACCESS,ISDIR 
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/ CLOSE_NOWRITE,CLOSE,ISDIR ..2018_10_01_14_41_15.703606290
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_41_15.703606290/ CLOSE_NOWRITE,CLOSE,ISDIR 
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_41_15.703606290/ OPEN trackmefile
 16:41:18  ./volumes/kubernetes.io~configmap/trackmevolume/..2018_10_01_14_41_15.703606290/ ACCESS trackmefile

The same series of events repeat every time the pod is crashlooping.

I can also repro this on minikube v1.11.3 with cri-o and containerd alike.

@bjhaid
Copy link
Contributor

bjhaid commented Oct 16, 2018

this seems related to:

moby/moby#37083

@qiujian16
Copy link
Contributor

We meet this error also when using secret subpath. We use kubernetes v1.11.0 and docker 18.03.

@lukemassa
Copy link

I saw this issue with kubernetes v1.12.4 and docker 18.09.0. (I opened #72699 which I will now close as a dupe)

@thoro
Copy link

thoro commented Jan 18, 2019

Also have this issue with v1.12.2, haven't had it before with < 1.9 I believe

very annoying!

@candidoma
Copy link

I have the same issue with docker 1.11.5 using AKS.
I found a workaround using projected key for volumes definition.

apiVersion: v1
kind: ConfigMap
metadata:
  name: test-configmap
  namespace: test-cfg
data:
  common1.json: |
    {
      "logger": {
        "enabled": true,
        "level": "info",
        "extreme": false,
        "stream": "stdout"
      }
    }
  common2.json: |
    {
      "test": 4         
    }
---
apiVersion: v1
kind: Pod 
metadata:
  name: issue
  namespace: test-cfg
spec:
  volumes:
  - name: conf-volume
    configMap:
      name: test-configmap
  containers:
  - name: test
    image: ubuntu:bionic
    command: ["sleep", "30"]
    resources:
      requests:
        cpu: 100m
    volumeMounts:
      - name: conf-volume
        mountPath: /etc/common1.json
        subPath: common1.json
      - name: conf-volume
        mountPath: /etc/common2.json
        subPath: common2.json
---
apiVersion: v1
kind: Pod 
metadata:
  name: working
  namespace: test-cfg
spec:
  volumes:
  - name: conf-volume
    projected:
      sources:
      - configMap:
          name: test-configmap
          items:
            - key: common1.json
              path: common1.json
            - key: common2.json
              path: common2.json
  containers:
  - name: test-container
    image: ubuntu:bionic
    imagePullPolicy: "Always"
    resources:
      requests:
        cpu: 100m
    volumeMounts:
      - name: conf-volume
        mountPath: /test
    command: ["sleep", "30"]

With this configuration , Issue pod will not restart, instead working pod will work.
Steps are the same as described here

@teijinyer
Copy link

this seems related to:

moby/moby#37083

docker fixed this bug in the 18.06.03-ce , but I also saw this issue with kubernetes v1.13.2 and docker 18.06.03-ce

dulek added a commit to dulek/openshift-ansible that referenced this issue Jun 18, 2019
When kuryr-config ConfigMap gets edited and kuryr-daemon pod gets
restarted we seem to suffer from bug [1]. As it's still open, this
commit works it around by removing subPath option used when mounting
kuryr.conf. Instead projected volumes are used for both kuryr-controller
and kuryr-cni pods.

[1] kubernetes/kubernetes#68211
jmartisk pushed a commit to jmartisk/openshift-ansible that referenced this issue Jun 24, 2019
When kuryr-config ConfigMap gets edited and kuryr-daemon pod gets
restarted we seem to suffer from bug [1]. As it's still open, this
commit works it around by removing subPath option used when mounting
kuryr.conf. Instead projected volumes are used for both kuryr-controller
and kuryr-cni pods.

[1] kubernetes/kubernetes#68211
@yehaifeng
Copy link

I get the same issue in openshit 1.13, kubernetes 1.11.0
When pod restart and then mount fail.

Jul 01 18:45:48 paas-node010002.99bill.com origin-node[54267]: E0701 18:45:48.898167 54267 remote_runtime.go:209] StartContainer "c442998c576878395b30d2c831c3d42fbdbf75171b21a22ccde0e1141fdd3671" from runtime service failed: rpc error: code = Unknown desc = failed to start container "c442998c576878395b30d2c831c3d42fbdbf75171b21a22ccde0e1141fdd3671": Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:364: container init caused "rootfs_linux.go:54: mounting \"/var/lib/origin/openshift.local.volumes/pods/41a4791b-5470-11e9-b356-005056b6696f/volume-subpaths/start/smsfinal-gzdlinfo-gateway/2\" to rootfs \"/var/lib/docker/overlay2/0f3564390916e039400e747e369c869db52cf32f4acb1aeb27e4f8ff961ab8a3/merged\" at \"/var/lib/docker/overlay2/0f3564390916e039400e747e369c869db52cf32f4acb1aeb27e4f8ff961ab8a3/merged/opt/oracle/start.sh\" caused \"no such file or directory\"""

openstack-gerrit pushed a commit to openstack/kuryr-kubernetes that referenced this issue Jul 5, 2019
From time to time in the gate we suffer from Kubernetes/Docker bug [1].
As it seems to still be open, we can work it around by removing usage of
subPath property of volumeMounts attached to Kuryr pods and this commit
does so. Besides that it removes possibility of providing different
kuryr.conf for kuryr-controller and kuryr-daemon as this shouldn't be
required as we don't support running without kuryr-daemon anymore.

[1] kubernetes/kubernetes#68211

Closes-Bug: 1833228
Change-Id: I2465bc45324482cc4ab32a1367ab08f34ce28b1c
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Jul 5, 2019
* Update kuryr-kubernetes from branch 'master'
  - Merge "Remove subPaths when mounting Kuryr pods volumes"
  - Remove subPaths when mounting Kuryr pods volumes
    
    From time to time in the gate we suffer from Kubernetes/Docker bug [1].
    As it seems to still be open, we can work it around by removing usage of
    subPath property of volumeMounts attached to Kuryr pods and this commit
    does so. Besides that it removes possibility of providing different
    kuryr.conf for kuryr-controller and kuryr-daemon as this shouldn't be
    required as we don't support running without kuryr-daemon anymore.
    
    [1] kubernetes/kubernetes#68211
    
    Closes-Bug: 1833228
    Change-Id: I2465bc45324482cc4ab32a1367ab08f34ce28b1c
airshipbot pushed a commit to airshipit/shipyard that referenced this issue Jul 21, 2019
Because of a kubernetes bug [0] when a container which
is mounted with the subpath option, the configmap is
changed and then the container restarts the mounting of
the configmap fails.

This PS uses the projected key for volume definitions
as a workaround.

[0] kubernetes/kubernetes#68211

Change-Id: I6820a0f963c5b28e1674ea58214ffc86009db4dd
dulek added a commit to dulek/kuryr-kubernetes that referenced this issue Aug 2, 2019
From time to time in the gate we suffer from Kubernetes/Docker bug [1].
As it seems to still be open, we can work it around by removing usage of
subPath property of volumeMounts attached to Kuryr pods and this commit
does so. Besides that it removes possibility of providing different
kuryr.conf for kuryr-controller and kuryr-daemon as this shouldn't be
required as we don't support running without kuryr-daemon anymore.

[1] kubernetes/kubernetes#68211

Closes-Bug: 1833228
Change-Id: I2465bc45324482cc4ab32a1367ab08f34ce28b1c
@gbraxton
Copy link

Issue seen on k8s 1.14.3, docker 18.06.3-ce, CoreOs Container Linux 2135.5.0 with subPath from secret in the same directory where another secret has a subPath

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@Alcatros
Copy link

Alcatros commented Apr 5, 2020

Just had this in production, anyone knows how i can fix this ?

-> Deleted the container as advised above...

kubectl delete pod

@juliantaylor
Copy link
Contributor Author

To work around the problem ensure that your deployments recreate the pods when you configmaps change, for example by adding a checksum of the configmaps to the annotations of the deployment/statefulset pod template.

@DarthSlider
Copy link

We have exactly the same problem even without the modification of configmap.
If container fails (just kill PID 1 in the container) it can't start.
Restarting whole pod works.

Removed subpath and mounted configmap to separate dir and the problem is gone.
k8s 1.16.2
docker 19.3.2

@micmax93
Copy link

micmax93 commented May 7, 2020

We are also experiencing this issue (GKE with k8s 1.15 & 1.16).
As a workaround we have used slightly simpler version of workaround shown by @Zero-2 with items field for ConfigMapVolumeSource instead of using projected volume, for example:

volumes:
- name: app-config
  configMap:
    name: app-config
    items:
    - key:  config.json
      path: config.json

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/#configmapvolumesource-v1-core

@bavarianbidi
Copy link

Can reproduce the issue with the example from above in three different environments.

  • k8s 1.18.3 with containerd://1.3.4
  • k8s 1.17.6 with containerd://1.3.4
  • k8s 1.16.6 with docker://19.3.3

Steps to reproduce:

  1. apply example from above
  2. edit content of the configmap (kubectl edit cm test-configmap or edit file and apply again)
  3. watch the pods...

using .spec.volumes.projected works fine where .spec.volumes.configMap lead to this issue

@JasonRD
Copy link

JasonRD commented Jun 30, 2020

any progress?

@nagstaku
Copy link

Happened for me again today with k8s 1.17

@k3a
Copy link

k3a commented Jul 31, 2020

nagstaku: Please read the task closing reason. It was fixed by #89629 and is part of k8s v1.19.0-rc.0 or newer. Until then, use #68211 (comment) workaround.

@cbf123
Copy link
Contributor

cbf123 commented Aug 6, 2020

has anyone confirmed whether the fix works when using containerd directly on current kubernetes? It doesn't seem to work on 1.18.1.

@JasonRD
Copy link

JasonRD commented Aug 7, 2020 via email

@qixiaobo
Copy link

has anyone confirmed whether the fix works when using containerd directly on current kubernetes? It doesn't seem to work on 1.18.1.

We use 1.16 also meet this problem~

@teppokauppinen
Copy link

We had this issue in AWS EKS today

Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.9-eks-4c6976", GitCommit:"4c6976793196d70bc5cd29d56ce5440c9473648e", GitTreeState:"clean", BuildDate:"2020-07-17T18:46:04Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

@hagel86
Copy link

hagel86 commented Dec 3, 2020

Any reason this was closed? Looks like it's still an issue.

@cbf123
Copy link
Contributor

cbf123 commented Dec 3, 2020

Any reason this was closed? Looks like it's still an issue.

It was closed because #89629 was submitted against the development branch. But you're still going to see the problem on older versions unless a fix is backported.

And as I mentioned in #93691 I think the backport to 1.18.1 was buggy, which makes me wonder about other versions.

mariusleu pushed a commit to sapcc/helm-charts that referenced this issue Feb 15, 2021
We still have crashlooping pods when the container exits
(e.g. when the process is killed manually or by exception).
Fabian Ruff found a bug, that should explain the behavior:
  kubernetes/kubernetes#68211 (comment)

This bug also contains a workaround, that's implemented here: use a
projected configMap instead of mounting directly from the original ones.
This way, an updated configMap will not be seen by the restarting
container and thus will not lead to the crashloop we've seen.

CCM-9905
@fzu-huang
Copy link

Is there a better solution in versions before v1.19?

luong-komorebi added a commit to luong-komorebi/mkodocx-clamav-helm that referenced this issue Jul 6, 2021
fwiesel pushed a commit to sapcc/helm-charts that referenced this issue Jul 11, 2022
We still have crashlooping pods when the container exits
(e.g. when the process is killed manually or by exception).
Fabian Ruff found a bug, that should explain the behavior:
  kubernetes/kubernetes#68211 (comment)

This bug also contains a workaround, that's implemented here: use a
projected configMap instead of mounting directly from the original ones.
This way, an updated configMap will not be seen by the restarting
container and thus will not lead to the crashloop we've seen.

CCM-9905
fwiesel pushed a commit to sapcc/helm-charts that referenced this issue Jul 13, 2022
We still have crashlooping pods when the container exits
(e.g. when the process is killed manually or by exception).
Fabian Ruff found a bug, that should explain the behavior:
  kubernetes/kubernetes#68211 (comment)

This bug also contains a workaround, that's implemented here: use a
projected configMap instead of mounting directly from the original ones.
This way, an updated configMap will not be seen by the restarting
container and thus will not lead to the crashloop we've seen.

CCM-9905
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/storage Categorizes an issue or PR as relevant to SIG Storage.
Projects
None yet