Error communicating with the configmap

As mentioned in "kubectl create configmap --help": --from-env-file='': Specify the path to a file to read lines of key=val pairs to create a configmap (i.e. a Docker .env file).

so you just need to make a file named conf with value like:

database_user= root
database_password= root
database_db= db
database_port= 5432
database_host= mypostgres

and run: "kubectl create configmap coco-config --from-env-file=conf"

UPDATE: If you put your data in " ", problem will be fixed

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"

Try configmap --from-env-file=configm


Do not use --from-file command. Try kubectl apply -f configmap.yaml