can't mount configMap on kubernetes

5/5/2016

Following the instructions on the config maps docs I can't get the contents of a config map. I create the config

apiVersion: v1 kind: ConfigMap metadata: name: special-config namespace: default data: special.how: very special.type: charm

And the pod

apiVersion: v1 kind: Pod metadata: name: dapi-test-pod spec: containers: - name: test-container image: gcr.io/google_containers/busybox command: [ "busybox", "cat", "/etc/config/special.how" ] volumeMounts: - name: config-volume mountPath: /etc/config volumes: - name: config-volume configMap: name: special-config restartPolicy: Never

When I run this pod I get the following

kubectl logs dapi-test-pod cat: can't open '/etc/config/special.how': No such file or directory

If I change the configMap name to be something that doesn't exist, the pod never launches so basically it seems to have found the config map, the volume seems to have been mounted but there is nothing in it.

Following the guide to use env vars from a configMap works correctly, it only seems to be configMap as a file that has the problem. I'm completely stuck :(

Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.3+882d296", GitCommit:"882d296a99218da8f6b2a340eb0e81c69e66ecc7", GitTreeState:"not a git tree"} Server Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0+$Format:%h

quot;, GitCommit:"$Format:%H
quot;, GitTreeState:"not a git tree"}

-- shmish111
kubernetes

0 Answers