i have simple logstash deployment and I like to store the sensitive passwords in secret in Kubernetes i will use secrets and i want to pull it from env vars into the logstash config. the problem is that i need to get the variables in ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
  name: logstash-config
  namespace: elastic-foo
data:
  logstash.yml: |
    http.host: "0.0.0.0"
    path.config: /usr/share/logstash/pipeline
  logstash.conf: |
    # all input will come from filebeat, no local logs
    input {
      s3 {
        "access_key_id" => ${access_key_id_pass}
        "secret_access_key" => ${secret_access_key_pass}
      }
    }
    filter {
    }
    output {
      stdout { codec => rubydebug }
      elasticsearch {
        index => "logstash-%{[@metadata]}"
        hosts => [ "http://xxxxxxxxx.svc:9200" ]
        user => ${user_name}
        password => ${password_pass}
      }
    }
This is the secrets yml:
apiVersion: v1
kind: Secret
metadata:
  name: elastic-secret
  namespace: elasticxxxx
stringData:
  elasticsearch-password: xxxxx
  elasticsearch-user: xxxx
  access-key-id: xxxx
  secret-access-key: xxxxx
This example doesn't work, i have the passwords in kube scerts and the environment variables are there in the container.