kubernetes: ConfigMaps volume doesn't create file in container

k8s 1.2 deployed locally, single-node docker Following the example in the ConfigMaps guide:

[root@totoro brs-kubernetes]# kubectl create -f example.yaml 
configmap "special-config" created
pod "dapi-test-pod" created
[root@totoro brs-kubernetes]# kubectl exec -it dapi-test-pod -- sh
/ # cd /etc/config/
/etc/config # ls
/etc/config # ls -alh
total 4
drwxrwxrwt    2 root     root          40 Mar 23 18:47 .
drwxr-xr-x    7 root     root        4.0K Mar 23 18:47 ..
/etc/config # 

example.yaml

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

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

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 36 (18 by maintainers)

Commits related to this issue

Most upvoted comments

FYI, we were able to resolve our issue with the mount flags inside docker-machine by running the following command, before creating the kubelet docker image:

docker-machine ssh $(docker-machine active) sudo mount --make-shared /