usage of config-maps in gke deployments

86 views
Skip to first unread message

ramues...@gmail.com

unread,
Feb 2, 2018, 1:46:02 AM2/2/18
to Kubernetes user discussion and Q&A
I have created config-map and I am using the following yaml file to create a pod which uses the data as env variables but I am getting crashloopbackoff. When I remove the " command: [ "/bin/sh", "-c", "env" ]". It is running but i did not see any env variables in the pod. "echo $KUBE_CONFIG_1". It shows up blank. Can you please help me resolving this. (MY reqyuirement is to use env variables in configmap and attach it to the pod).

apiVersion: v1
kind: Pod
metadata:
name: config-env-test-pod
spec:
containers:
- name: test-container
image: gcr.io/google_containers/busybox
command: [ "/bin/sh", "-c", "env" ]
env:
- name: KUBE_CONFIG_1
valueFrom:
configMapKeyRef:
name: test-configmap
key: data-1
- name: KUBE_CONFIG_2
valueFrom:
configMapKeyRef:
name: test-configmap
key: data-2

Ahmet Alp Balkan

unread,
Feb 2, 2018, 2:21:20 AM2/2/18
to kubernet...@googlegroups.com
I can't reproduce your problem./ I see the KUBE_CONFIG_1 and _2 just fine when I deploy this pod.

I just created configmap:

    kubectl create configmap test-configmap --from-literal=data-1=foo --from-literal=data-2=bar

If you're seeing a crashloopbackoff, it probably doesn't have anything to do with "command".

Do "kubectl describe -f FILE.yaml" to see why it's crashing. It probably can't find the configmap or one of its keys.


--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Ramu Immadi

unread,
Feb 13, 2018, 10:48:31 AM2/13/18
to kubernet...@googlegroups.com
When I remove that "command" it worked fine.
I used my own image which is have Java alpine image.

Regards
Ram



You received this message because you are subscribed to a topic in the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-users/AMS4BxNsrfc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-users+unsubscribe@googlegroups.com.

Ramu Immadi

unread,
Feb 13, 2018, 10:48:52 AM2/13/18
to kubernet...@googlegroups.com
I am using kubernetes 1.8

You received this message because you are subscribed to a topic in the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-users/AMS4BxNsrfc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages