<p>I am wondering if there is a way to set up dynamically environment variables on a scale depending on the high load.</p>
<p>Let's imagine that we have</p>
<p>Kubernetes with service called <code>Generic Consumer</code> which at the beginning have 4 pods. First of all
I would like to set that 75% of pods should have env variable  <code>Gold</code> and 25% <code>Platinium</code>. Is that possible? (% can be changed to static number for example 3 nodes <code>Gold</code>, 1 <code>Platinium</code>)</p>
<p>Second question:
If <code>Platinium</code> pod is having a high load is there a way to configure Kubernetes/charts to scale only the <code>Platinium</code> and then decrease it after higher load subsided
So far I came up with creating 2 separate YAML files with diff env variables and replicas numbers.</p>
<p>Obviously, the whole purpose of this is to prioritize some topics
I have used this as a reference <a href="https://www.confluent.io/blog/prioritize-messages-in-kafka" rel="nofollow noreferrer">https://www.confluent.io/blog/prioritize-messages-in-kafka</a>.
So in the above example, <code>Generic Consumer</code> would be the Kafka consumer which would use env variable to get bucket config</p>
<pre><code>configs.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
   BucketPriorityAssignor.class.getName());
configs.put(BucketPriorityConfig.TOPIC_CONFIG, &quot;orders-per-bucket&quot;);
configs.put(BucketPriorityConfig.BUCKETS_CONFIG, &quot;Platinum, Gold&quot;);
configs.put(BucketPriorityConfig.ALLOCATION_CONFIG, &quot;70%, 30%&quot;);
configs.put(BucketPriorityConfig.BUCKET_CONFIG, &quot;Platinum&quot;);
consumer = new KafkaConsumer&lt;&gt;(configs);
</code></pre>
<p>If you have any alternatives, please let me know!</p>

blacky
<p>As was mention in comment section, the most versitale option (and probably the best for your scenario with prioritization) is to keep two separate deployments with <code>gold</code> and <code>platinium</code> <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/" rel="nofollow noreferrer">labels</a>.</p>
<p>Regarding first question, like <code>@David Maze</code> pointed, pods from <code>Deployment</code> are identical and you cannot have few pods with one label and few others with different. Even if you would create manually (3 pods with <code>gold</code> and 1 with <code>platiunuim</code>) you won't be able to use <code>HPA</code>.</p>
<p>This option allows you to adjustments depends on the situation. For example you would be able to scale one deployment using <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">HPA</a> and another with <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/verticalpodautoscaler" rel="nofollow noreferrer">VPA</a> or both with <code>HPA</code>. Would help you maintain budget, i.e for <code>gold</code> users you might limit to have maximum 5 pods to run simultaneously and for <code>platinium</code> you could set this maximum to 10.</p>
<p>You could consider <a href="https://istio.io/latest/docs/concepts/traffic-management/" rel="nofollow noreferrer">Istio Traffic Management</a> to routing request, but in my opinion, method with two separated deployments is more suitable.</p>
