How can I generate ConfigMap from directory without create it?
If I use:
$ kubectl create configmap my-config --from-file=configuration/ -o yaml
apiVersion: v1
data:
...
ConfigMap yaml output is displayed but my-config
is created on current Kubernetes project context.
I would like only generate ConfigMap file, it is possible? Are there a kubectl create
"dry" mode?
Best regards,
Stéphane
You can use kubectl create configmap to create a ConfigMap from multiple files in the same directory. When you are creating a ConfigMap based on a directory, kubectl identifies files whose basename is a valid key in the directory and packages each of those files into the new ConfigMap.
The simplest way to create a ConfigMap is to store a bunch of key-value strings in a ConfigMap YAML file and inject them as environment variables into your Pods. After that, you can reference the environment variables in your applications using whatever methods is necessary for your programming language.
You can use the kubectl create configmap command to create configmaps easily from literal values, files, or directories.
Just add --dry-run
so:
$ kubectl create configmap my-config --from-file=configuration/ -o yaml --dry-run
Source: https://kubernetes.io/docs/user-guide/kubectl/kubectl_create_configmap/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With