<p>I have 20 users. I need to use individual container for every user. I want to pass 'user_id' by environments. When i receive message, i need to create another one container with 'user_id', which i received.  how to organize it in kubernetes by the best way</p>

Влад Концевич
<p>If you have several users, I would suggest identifying them with <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/" rel="nofollow noreferrer">service accounts</a>.</p>

<p>Once you've created service accounts for every user, you can assign them to Pods with the <code>spec.serviceAccountName</code> keyword. This field is available inside Pods using the <a href="https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/" rel="nofollow noreferrer">Downward Api</a>. For example:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: pod-name
spec:
  containers:
    - name: container-name
      image: busybox
      command: [ "sh", "-c", "echo $SERVICE_ACCOUNT"]
      env:
        - name: SERVICE_ACCOUNT
          valueFrom:
            fieldRef:
              fieldPath: spec.serviceAccountName
</code></pre>
