<p>I am trying to create Pod in kubernetes cluster to start the docker image. I used <a href="https://mvnrepository.com/artifact/io.kubernetes/client-java/8.0.0" rel="nofollow noreferrer">⁠client-java</a> version 8.0.0 to create pod cluster. I used this doc ⁠<a href="https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/FluentExample.java#L39-L55" rel="nofollow noreferrer">kubernetes-client</a> to create Pod cluster. But I couldn't set the environment variables for docker container.</p>

<p><strong>Code:</strong></p>

<pre><code>Map&lt;String, String&gt; attributes = myObject.getAttributes(); //need to set this attributes as environment variables in pod creation
// create pod of a Kubernetes cluster
V1Pod pod = new V1PodBuilder().withNewMetadata().withName(serviceName).endMetadata()
                     .withNewSpec().addNewContainer().withName("www").withImage(dockerImage).endContainer().endSpec()
                        .build();
</code></pre>

<p>How to set environment variables <code>(Map&lt;String, String&gt;)</code> for docker container while creating pod?</p>

<p>Any inputs here really appreciated.</p>

SST
<p>Use <a href="https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/FluentExample.java#L64" rel="nofollow noreferrer">2n'd example</a> from Your referenced code and add <code>setEnv</code> <a href="https://github.com/kubernetes-client/java/blob/c5d7d3a7cadbd240008b6e76ba9d9c134e0c4b79/kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1Container.java#L221" rel="nofollow noreferrer">call</a> to <code>V1Container</code>.</p>
