ConfigMaps volume not creating file in container

0 votes

So I've deployed a local single-node cluster. For some reason the config maps doesn't create file in conatiner. I followed the example in the configmaps guide and /etc/config/special.how should be created below but there is no such file there. Is there something that I'm doing wrong:

[root@nonipo brs-kubernetes]# kubectl create -f example.yaml 
configmap "special-config" created
pod "dapi-test-pod" created
[root@nonipo 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

Summary of conformance test failures follows (asked to run by jayunit100). Full run in this gist.

Summarizing 7 Failures:

[Fail] ConfigMap [It] updates should be reflected in volume [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/configmap.go:262

[Fail] Downward API volume [It] should provide podname only [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/util.go:1637

[Fail] Downward API volume [It] should update labels on modification [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/downwardapi_volume.go:82

[Fail] ConfigMap [It] should be consumable from pods in volume with mappings [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/util.go:1637

[Fail] Networking [It] should function for intra-pod communication [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/networking.go:121

[Fail] Downward API volume [It] should update annotations on modification [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/downwardapi_volume.go:119

[Fail] ConfigMap [It] should be consumable from pods in volume [Conformance] 
/home/schou/dev/kubernetes/_output/local/go/src/k8s.io/kubernetes/test/e2e/util.go:1637

Ran 93 of 265 Specs in 2875.468 seconds
FAIL! -- 86 Passed | 7 Failed | 0 Pending | 172 Skipped --- FAIL: TestE2E (2875.48s)
FAIL

findmnt Output:

[schou@nonipo single-node]$ findmnt
TARGET                                SOURCE     FSTYPE  OPTIONS
/                                     /dev/mapper/fedora-root
│                                                ext4    rw,relatime,data=ordere
├─/sys                                sysfs      sysfs   rw,nosuid,nodev,noexec,
│ ├─/sys/kernel/security              securityfs securit rw,nosuid,nodev,noexec,
│ ├─/sys/fs/cgroup                    tmpfs      tmpfs   ro,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/systemd          cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/cpuset           cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/net_cls,net_prio cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/memory           cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/hugetlb          cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/cpu,cpuacct      cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/perf_event       cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/pids             cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/blkio            cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ ├─/sys/fs/cgroup/freezer          cgroup     cgroup  rw,nosuid,nodev,noexec,
│ │ └─/sys/fs/cgroup/devices          cgroup     cgroup  rw,nosuid,nodev,noexec,
│ ├─/sys/fs/pstore                    pstore     pstore  rw,nosuid,nodev,noexec,
│ ├─/sys/firmware/efi/efivars         efivarfs   efivarf rw,nosuid,nodev,noexec,
│ ├─/sys/kernel/debug                 debugfs    debugfs rw,relatime
│ ├─/sys/kernel/config                configfs   configf rw,relatime
│ └─/sys/fs/fuse/connections          fusectl    fusectl rw,relatime
├─/proc                               proc       proc    rw,nosuid,nodev,noexec,
│ ├─/proc/sys/fs/binfmt_misc          systemd-1  autofs  rw,relatime,fd=32,pgrp=
│ └─/proc/fs/nfsd                     nfsd       nfsd    rw,relatime
├─/dev                                devtmpfs   devtmpf rw,nosuid,size=8175208k
│ ├─/dev/shm                          tmpfs      tmpfs   rw,nosuid,nodev
│ ├─/dev/pts                          devpts     devpts  rw,nosuid,noexec,relati
│ ├─/dev/mqueue                       mqueue     mqueue  rw,relatime
│ └─/dev/hugepages                    hugetlbfs  hugetlb rw,relatime
├─/run                                tmpfs      tmpfs   rw,nosuid,nodev,mode=75
│ ├─/run/user/42                      tmpfs      tmpfs   rw,nosuid,nodev,relatim
│ │ └─/run/user/42/gvfs               gvfsd-fuse fuse.gv rw,nosuid,nodev,relatim
│ └─/run/user/1000                    tmpfs      tmpfs   rw,nosuid,nodev,relatim
│   └─/run/user/1000/gvfs             gvfsd-fuse fuse.gv rw,nosuid,nodev,relatim
├─/tmp                                tmpfs      tmpfs   rw
├─/boot                               /dev/sda2  ext4    rw,relatime,data=ordere
│ └─/boot/efi                         /dev/sda1  vfat    rw,relatime,fmask=0077,
├─/var/lib/nfs/rpc_pipefs             sunrpc     rpc_pip rw,relatime
├─/var/lib/kubelet/pods/fd20f710-fb82-11e5-ab9f-0862662cf845/volumes/kubernetes.io~secret/default-token-qggyv
│                                     tmpfs      tmpfs   rw,relatime
├─/var/lib/kubelet/pods/2f652e15-fb83-11e5-ab9f-0862662cf845/volumes/kubernetes.io~configmap/config-volume
│                                     tmpfs      tmpfs   rw,relatime
└─/var/lib/kubelet/pods/2f652e15-fb83-11e5-ab9f-0862662cf845/volumes/kubernetes.io~secret/default-token-6bzfe
                                      tmpfs      tmpfs   rw,relatime
Sep 6, 2018 in Kubernetes by Atul
• 10,240 points
935 views

1 answer to this question.

0 votes
Did a little research and found the problem. My mount propagation mode of /var/lib/kubelet was private. Changed the mount flag for the kubelet dir to -v /var/lib/kubelet:/var/lib/kubelet:rw,shared. I also changed the MountFlags=slave to MountFlags=shared in my docker systemd file.
answered Sep 6, 2018 by Atul
• 10,240 points

Related Questions In Kubernetes

0 votes
1 answer

Set volume mount user group and file permissions in kubernetes

There's a setting in Pod Security Context ...READ MORE

answered Jan 16, 2019 in Kubernetes by ajs3033
• 7,300 points
27,297 views
0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,300 points
2,226 views
0 votes
3 answers

Using multiple commands in a kubernetes yaml file

Try something like this: containers: - name: ...READ MORE

answered Apr 23, 2019 in Kubernetes by lyza
48,911 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
14,590 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,075 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP