1

I am wondering if there is a way to set up dynamically environment variables on a scale depending on the high load.

Let's imagine that we have

Kubernetes with service called Generic Consumer which at the beginning have 4 pods. First of all I would like to set that 75% of pods should have env variable Gold and 25% Platinium. Is that possible? (% can be changed to static number for example 3 nodes Gold, 1 Platinium)

Second question: If Platinium pod is having a high load is there a way to configure Kubernetes/charts to scale only the Platinium 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.

Obviously, the whole purpose of this is to prioritize some topics I have used this as a reference https://www.confluent.io/blog/prioritize-messages-in-kafka. So in the above example, Generic Consumer would be the Kafka consumer which would use env variable to get bucket config

configs.put(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
   BucketPriorityAssignor.class.getName());
configs.put(BucketPriorityConfig.TOPIC_CONFIG, "orders-per-bucket");
configs.put(BucketPriorityConfig.BUCKETS_CONFIG, "Platinum, Gold");
configs.put(BucketPriorityConfig.ALLOCATION_CONFIG, "70%, 30%");
configs.put(BucketPriorityConfig.BUCKET_CONFIG, "Platinum");
consumer = new KafkaConsumer<>(configs);

If you have any alternatives, please let me know!

3
  • Regarding first question you could use 2 deployments with specific label and service with 2 labels to bo "linked" with both deployments. If you would have 2 deployments you could create 2 HPA. Are you looking alternatives as option with 2 deployments won't work for you? Commented Feb 11, 2021 at 14:12
  • Thanks, @PjoterS right now I am doing research so I wanted to find out all possibilities available. Commented Feb 12, 2021 at 12:11
  • All of the pods produced from the same deployment are identical; they will all always have the same environment variables. I think the approach you currently have with two separate deployments is probably going to be the best one if the process needs to be told which priority tier it's working on. Commented Feb 14, 2021 at 0:35

1 Answer 1

1

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 gold and platinium labels.

Regarding first question, like @David Maze pointed, pods from Deployment 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 gold and 1 with platiunuim) you won't be able to use HPA.

This option allows you to adjustments depends on the situation. For example you would be able to scale one deployment using HPA and another with VPA or both with HPA. Would help you maintain budget, i.e for gold users you might limit to have maximum 5 pods to run simultaneously and for platinium you could set this maximum to 10.

You could consider Istio Traffic Management to routing request, but in my opinion, method with two separated deployments is more suitable.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes it answers my question, Thank you guys !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.