How can we use url of datasource in kubernetes while creating configmap

Viewed 1215

How can we use url of datasource in kubernetes while creating configmap like ex. kubectl create configmap config-from-file --from-file=https://url-to-file-location

2 Answers

No, currently it is not possible to directly use URL as source for a configMap property.

But this will do the trick:

kubectl create configmap config-from-url --from-literal=propkey="$(curl -k https://url-to-file-location)"

You can specify the namespace where to create the configMap with -n or --namespace - see kubectl options.

The -k option for curl allows connections to sites with untrusted (e.g. self-signed) certs.

Using wget instead of curl can be another option.

Related