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

10/25/2018

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

-- Paramanand Dhuri
configmap
kubernetes

2 Answers

10/25/2018

kubectl doesn't support creating configmaps using urls https://github.com/kubernetes/website/pull/9903

-- Ijaz Ahmad Khan
Source: StackOverflow

10/26/2018

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.

-- apisim
Source: StackOverflow