kubernetes: how to export existing env variables for ConfigMap file

1/10/2019

when try to export a value (CONSUL_DNS_SERVICE_HOST) from my env variables from my configMap file, I receive a error - PSB

# From my container:
> printenv CONSUL_DNS_SERVICE_HOST 
10.100.180.151

> kubectl -n kube-system get configmap coredns -o yaml 
apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors
        log
        health
        kubernetes cluster.local 10.0.0.0/24
        rewrite name . .default.svc.cluster.local
        prometheus :9153
        proxy . /etc/resolv.conf
        cache 30
        reload
    }
    consul:53 {
        log
        errors
        cache 30
        proxy . "$(printenv CONSUL_DNS_SERVICE_HOST)"

> kubectl logs --tail=20 -f coredns-7bcbfc4774-4n9p7 -n kube-system
2019/01/10 11:15:59 plugin/proxy: not an IP address or file: "$(printenv CONSUL_DNS_SERVICE_HOST)"

I find no way to retrieve the IP of CONSUL_DNS_SERVICE_HOST

thanks

-- Maurice Amar
configmap
environment-variables
kubernetes

0 Answers