Hi I am using google kubernetes engine to deploy my application. I tried to add a configMap
apiVersion: v1
kind: ConfigMap
metadata:
name: configmap
namespace: default
data:
database_user: root
database_password: root
database_db: db
database_port: 5432
database_host: mypostgres
And then in my application deployment file I mapped my envirement variables like the following
spec:
containers:
- env:
- name: DATABASE_HOST
valueFrom:
configMapKeyRef:
name: configmap
key: database_host
- name: DATABASE_NAME
valueFrom:
configMapKeyRef:
name: configmap
key: database_db
- name: DATABASE_PASSWORD
valueFrom:
configMapKeyRef:
name: configmap
key: database_password
- name: DATABASE_USER
valueFrom:
configMapKeyRef:
name: configmap
key: database_user
- name: DATABASE_PORT
valueFrom:
configMapKeyRef:
name: configmap
key: database_port
My service I not running and I got the
CreateContainerConfigError When I try to show the result of the pod
When I do "describe my pod " I got
Error: Couldn't find key database_host
My question is, why my deployment file are not commincating with the configmap I defined
I created the configmap via this command
kubectl create configmap configmap --from-file=configmap.yaml