<p>I have defined a sidecar container in a common.tpl file in my helm charts.
This sidecar container is included in numerous pods in which different users are used. </p>

<p>I was wondering if there is a way to define as user in the sidecar container the user of the application container. As a result in each pod the same user will be used for both my application and my sidecar container.</p>

<p>I was imagining something like the below:</p>

<pre><code>- name: sidecar_container
  image: sidecar_image:01
  imagePullPolicy: IfNotPresent
  securityContext:
    runAsUser: {{ some_variable_that_indicates_to_the_application's_container_user }}
</code></pre>

<p>Is there an option like that?</p>

SteveGr2015
<p>You can define the "SecurityContext" at Pod level , which means it will be applied to all containers inside the pod.</p>

<p><a href="https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/security/security-context.yaml" rel="nofollow noreferrer">Pod security context</a></p>
