<p>We have deployed Customized Confluent Kafka Connector as statefulset in Kubernetes, which mounts secrets from Azure KeyVault. These secrets contain db username and password &amp; are meant to be used while creating connectors via rest endpoint <code>https://kafka.mydomain.com/connectors</code> using Postman.</p>
<p>The secrets are being loaded as environment variables in container. And <code>kubernetes-ingress-controller</code> - <em>path based routing</em> is used for exposing rest endpoint.</p>
<p>So far, our team is unable to use the environment variables while creating connector through Postman.</p>
<p>Connector config:</p>
<pre><code>{
 &quot;name&quot;: &quot;TEST.CONNECTOR.SINK&quot;,
    &quot;config&quot;: {
        
    &quot;connector.class&quot;: &quot;io.confluent.connect.jdbc.JdbcSinkConnector&quot;,
    &quot;errors.log.include.messages&quot;: &quot;true&quot;,
    &quot;table.name.format&quot;: &quot;AuditTransaction&quot;,
    &quot;connection.password&quot;: &quot;iampassword&quot;,             &lt;------------ (1)
    &quot;flush.size&quot;: &quot;3&quot;,
    &quot;tasks.max&quot;: &quot;1&quot;,
    &quot;topics&quot;: &quot;TEST.CONNECTOR.SOURCE-AuditTransaction&quot;,
    &quot;key.converter.schemas.enable&quot;: &quot;false&quot;,
    &quot;connection.user&quot;: &quot;iamuser&quot;,                     &lt;------------ (2)
    &quot;value.converter.schemas.enable&quot;: &quot;true&quot;,
    &quot;name&quot;: &quot;TEST.CONNECTOR.SINK&quot;,
    &quot;errors.tolerance&quot;: &quot;all&quot;,
    &quot;connection.url&quot;: &quot;jdbc:sqlserver://testdb.database.windows.net:1433;databaseName=mytestdb01&quot;,
    &quot;value.converter&quot;: &quot;org.apache.kafka.connect.json.JsonConverter&quot;,
    &quot;insert.mode&quot;: &quot;insert&quot;,
    &quot;errors.log.enable&quot;: &quot;true&quot;,
    &quot;key.converter&quot;: &quot;org.apache.kafka.connect.json.JsonConverter&quot;
}  
}
</code></pre>
<p><em><strong>(1) and (2)</strong></em> - Here we want to use system environment variables with Values - <code>$my_db_username=iamuser</code>, <code>$my_db_password=iampassword</code>. We have tried using <code>&quot;$my_db_username&quot;</code> and <code>&quot;$my_db_password&quot;</code> there but in logs of Connector Pod, it doesn't resolve to the respective values.</p>
<p>Logs:</p>
<pre><code>[2020-07-28 12:31:22,838] INFO Starting JDBC Sink task (io.confluent.connect.jdbc.sink.JdbcSinkTask:44)
[2020-07-28 12:31:22,839] INFO JdbcSinkConfig values: 
    auto.create = false
    auto.evolve = false
    batch.size = 3000
    connection.password = [hidden]
    connection.url = jdbc:sqlserver://testdb.database.windows.net:1433;databaseName=mytestdb01
    connection.user = $my_db_username
    db.timezone = UTC
    delete.enabled = false
    dialect.name = 
    fields.whitelist = []
    insert.mode = insert
    max.retries = 10
    pk.fields = []
    pk.mode = none
    quote.sql.identifiers = ALWAYS
    retry.backoff.ms = 3000
    table.name.format = AuditTransaction
</code></pre>
<p>Is there any way to use system/container environment variables in this config, while creating connectors with Postman or something else?</p>

Aditya Jalkhare
<p>Finally did it!! Using <code>FileConfigProvider</code>. All the needed information was <a href="https://docs.confluent.io/current/connect/security.html#externalizing-secrets" rel="nofollow noreferrer">here</a>.</p>
<p>We just had to parametrize <code>connect-secrets.properties</code> according to our requirement and substitute env vars value on startup.</p>
<p>This doesn't allow using Env Vars via Postman. But parametrized <code>connect-secrets.properties</code> specifically tuned according to our need did the job and <code>FileConfigProvider</code> did the rest by picking values from <code>connect-secrets.properties</code></p>
<h2>Update</h2>
<p>Found a way to implement this using env vars <a href="https://github.com/giogt/kafka-env-config-provider" rel="nofollow noreferrer">here</a>.</p>
