Secret volumes do not work on multinode docker setup

8/29/2015

I have setup a multinode kubernetes 1.0.3 cluster using instructions from https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/docker-multinode.md.

I create a secret volume using the following spec in myns namespace:

apiVersion: v1 kind: Secret metadata: name: mysecret namespace: myns labels: name: mysecret data: myvar: "bUNqVlhCVjZqWlZuOVJDS3NIWkZHQmNWbXBRZDhsOXMK"

Create secret volume:

$ kubectl create -f mysecret.yml --namespace=myns

Check to see if secret volume exists:

$ kubectl get secrets --namespace=myns NAME TYPE DATA mysecret Opaque 1

Here is the Pod spec of the consumer of the secret volume:

apiVersion: v1 kind: Pod metadata: name: busybox namespace: myns spec: containers: - image: busybox command: - sleep - "3600" name: busybox volumeMounts: - name: mysecret mountPath: /etc/mysecret readOnly: true volumes: - name: mysecret secret: secretName: mysecret

Create the Pod

kubectl create -f busybox.yml --namespace=myns

Now if I exec into the docker container to inspect the contents of the /etc/mysecret directory. I find it to be empty.

-- Sameer Naik
kubernetes

1 Answer

8/29/2015

What namespace are your pod and secret in? They must be in the same namespace. Would you post a gist or pastebin of the Kubelet log? That contains information that can help us diagnose this.

Also, are you running the Kubelet on your host directly or in a container?

-- Paul Morie
Source: StackOverflow