I am creating a config map as below
kubectl create configmap testconfigmap --from-file=testkey=testfile.txtAs I am using helm charts, I would like to create the config map using YAML file instead of running kubectl, so something like:
apiVersion: v1
kind: ConfigMap
metadata:
name: testconfigmap
data:
fromfile: testkey=testfile.txtThe --from-file allows me to pass the key and the value I read from the testfile.txt. But the fromfile doesn't work if I create configMap as YAML file.
The following command will generate the Yaml file you need to apply
kubectl create configmap testconfigmap —from-file=testkey=test file.txt —dry-run=client -o yaml > myconfigmap.yamlThen you can just do
kubectl apply -f myconfigmap.yaml