Skip to content

Secret volumes content is not available in containers #1469

Closed

Description

@jimmidyson

Working through with @pmorie.

Secrets/RC created via following manifest:


---
  id: "fabric8-config"
  kind: "Config"
  apiVersion: "v1beta1"
  name: "fabric8-config"
  description: "Creates a hawtio console"
  items:
    - apiVersion: "v1beta2"
      kind: "Secret"
      id: "openshift-cert-secrets"
      data:
        my-file: amltbWkK
    - apiVersion: "v1beta1"
      desiredState:
        podTemplate:
          desiredState:
            manifest:
              containers:
                - image: "busybox:latest"
                  name: "test-container"
                  imagePullPolicy: "PullIfNotPresent"
                  volumeMounts:
                    - name: openshift-cert-secrets
                      mountPath: /etc/secret-volume
                      readOnly: true
                  command:
                    - sleep
                    - 5000000
              id: "busyboxPod"
              version: "v1beta1"
              volumes:
                - name: openshift-cert-secrets
                  source:
                    secret:
                      target:
                        kind: Secret
                        namespace: default
                        name: openshift-cert-secrets
          labels:
            component: "test"
        replicaSelector:
          component: "test"
        replicas: 1
      id: "busybox-controller"
      kind: "ReplicationController"

Volume is mounted in container but contains no files, either visible in container or on host. Logs from a customized origin image provided by @pmorie with extra logging are available at https://gist.github.com/jimmidyson/d378d4a0e7c6f0fdfe0a, specifically see https://gist.github.com/jimmidyson/d378d4a0e7c6f0fdfe0a#file-openshift-log-L407-L421. Initial guess is that it's the Cleaner that's cleaning files too eagerly.

Activity

  1. pmorie commented on Mar 27, 2015

    @pmorie
    Contributor

    @jimmidyson I believe this is all sorted out now, want to comment with the resolution?

  2. jimmidyson commented on Mar 27, 2015

    @jimmidyson
    ContributorAuthor

    @pmorie um, well the resolution was to try again :) I think it was to do with a version mismatch between the client I was using & the server, but after a clean clone & build all worked fine. Thanks for your help @pmorie!

  3. jimmidyson commented on Mar 27, 2015

    @jimmidyson
    ContributorAuthor

    Although this worked fine with clean build from master earlier today, I've just tried again with docker image openshift/origin:latest from Docker hub & the issue still exists: secrets volume is mounted but contains no files & no files on host filesystem at mounted dir either. This is using the following manifests provided by @pmorie (https://gist.githubusercontent.com/pmorie/b6e7c4cdcc06247a1f8d/raw/45d7010c2f8b07ab277df1b8a26ac378bd3843f6/secret.json & https://gist.githubusercontent.com/pmorie/b6e7c4cdcc06247a1f8d/raw/9a33b80d7e777531600ef91d75646469e2d82798/pod.json)

    What could be the difference between local build & running in container? Even dir permissions are different in containers (1777 in local build vs 0750 when running openshift in docker container).

  4. smarterclayton commented on Mar 31, 2015

    @smarterclayton
    Contributor

    /tmpfs mounting maybe?

  5. added
    kind/bug
    on Apr 1, 2015
  6. pmorie commented on Apr 1, 2015

    @pmorie
    Contributor

    Our next step for this is to debug the all-in-one binary on @jimmidyson's system and step through what's happening. This behavior happens in permissive mode, so I don't think it's an selinux issue.

  7. jimmidyson commented on Apr 2, 2015

    @jimmidyson
    ContributorAuthor

    Just to confirm that this happens only when running OpenShift in a container. When running on host it works perfectly.

  8. smarterclayton commented on Apr 2, 2015

    @smarterclayton
    Contributor

    It's probably that no volumes that have to mount work properly in a container right now because the kubelet is not in the host's root namespace. That's an issue that we need to pursue upstream.

    On Apr 2, 2015, at 11:12 AM, Jimmi Dyson [email protected] wrote:

    Just to confirm that this happens only when running OpenShift in a container. When running on host it works perfectly.

    —
    Reply to this email directly or view it on GitHub.

  9. jimmidyson commented on Apr 2, 2015

    @jimmidyson
    ContributorAuthor

    Empty dir volumes work fine IIRC. Wouldn't that be affected in this case?

  10. smarterclayton commented on Apr 2, 2015

    @smarterclayton
    Contributor

    No because the daemon manages that from the host mount namespace.

    @pweil- @pmorie can you guys start a discussion upstream today about whether there is an easy fix that would allow a container running in a mount namespace to properly mount in the root? Bring the appinfra guys in on SPC (Dan Walsh) if you have to. If we are truly blocked on this without a workaround we can get upstream then we can't run the node in a container except in test environments. Hint: I think we need to find the minimal solution for 3.0 that doesn't involve massive complexity, but allows it to work.

    On Apr 2, 2015, at 12:33 PM, Jimmi Dyson [email protected] wrote:

    Empty dir volumes work fine IIRC. Wouldn't that be affected in this case?

    —
    Reply to this email directly or view it on GitHub.

  11. pweil- commented on Apr 2, 2015

    @pweil-

    I believe this is the quick fix: kubernetes/kubernetes#6238 (comment)

  12. pweil- commented on Apr 2, 2015

    @pweil-

    Sorry, that was the issue, this is the pr kubernetes/kubernetes#6319

  13. pmorie commented on Apr 9, 2015

    @pmorie
    Contributor

    @pweil- Unfortunately, that is not the fix; that is only to set the rootcontext of the tmpfs mountpoint to the same as that of the kubelet root dir. The issue @smarterclayton is getting at is that the kubelet process itself is not is the same mount namespace as the host. The container and kubelet wind up not sharing mount namespaces and thus the pod's containers do not see the mounts the kubelet makes.

  14. jimmidyson commented on Apr 9, 2015

    @jimmidyson
    ContributorAuthor

    @pmorie @pweil- Do you think there is a solution to this coming soon or should we stop recommending running OpenShift itself in a container for now?

  15. pmorie commented on Apr 9, 2015

    @pmorie
    Contributor

    @jimmidyson I don't have a read on it yet; I will let you know.

  16. pmorie commented on Apr 9, 2015

    @pmorie
    Contributor

    @jimmidyson Were you using a privileged container?

  17. pmorie commented on Apr 9, 2015

    @pmorie
    Contributor

    Looks like there's a relevant upstream issue for this: moby/moby#10088

  18. jimmidyson commented on Apr 9, 2015

    @jimmidyson
    ContributorAuthor

    Yes using a privileged container to run openshift all-in-one, but not for
    all other containers obviously.

    On 20:25, Thu, 9 Apr 2015 Paul Morie [email protected] wrote:

    Looks like there's a relevant upstream issue for this: moby/moby#10088
    moby/moby#10088

    —
    Reply to this email directly or view it on GitHub
    #1469 (comment).

  19. pmorie commented on Apr 15, 2015

    @pmorie
    Contributor

    Opened kubernetes/kubernetes#6848 upstream for this.

  20. liggitt commented on May 8, 2015

    @liggitt
    Contributor

    @pmorie upstream issue was closed... was this issue resolved?

  21. pmorie commented on May 8, 2015

    @pmorie
    Contributor

    @liggitt I need to make a change in origin for this - it's next in my queue
    On Thu, May 7, 2015 at 9:43 PM Jordan Liggitt [email protected]
    wrote:

    @pmorie https://github.com/pmorie upstream issue was closed... was this
    issue resolved?

    —
    Reply to this email directly or view it on GitHub
    #1469 (comment).

  22. pmorie commented on May 8, 2015

    @pmorie
    Contributor

    I tried to reproduce this tonight and couldn't. I can create the secrets example pod from upstream and see the content correctly.

  23. danmcp commented on May 11, 2015

    @danmcp

    Any remaining issues here?

  24. added a commit that references this issue on Feb 1, 2018
    0bb9982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component/appskind/bugpriority/P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions