How can I distrubute loads to Kubernetes Pods?

5/21/2019

I have work defined in a file/config with the following format,

config1,resource9
config3,resource21
config5,resource10

How can I spin individual pods based on the configuration? If I add one more line to the configuration, Kubernetes need to spin one more pod and send the configuration line to that pod.

How to store the configuration in Kubernetes and spin up pods based on the configuration?

-- Kannaiyan
kubernetes

1 Answer

5/22/2019

Take a look at Kubernetes Operators. The pattern adds a Kubernetes management layer to an application. Basically you run a kubernetes native app (the operator) that connects to the kubernetes API and takes care of the deployment management for you.

If you are familiar with helm, then a quick way to get started is with the helm example. This example will create a new Nginx deployment for each Custom Resource you create. The Custom Resource contains all the helm values nginx requires for a deployment.

As a first step you could customise the example so that all you need to do is manage the single Custom Resource to deploy or update the app.

If you want to take it further then you may run into some helm limitations pretty quickly, for advanced use cases you can use the go operator-sdk directly.

There are a number of projects operators to browse on https://operatorhub.io/

-- Matt
Source: StackOverflow