Post deployment pod creation/deletion based on service request

12/16/2020

We have .Net application which has to be deployed in K8 cluster. We use a Golang based operator which deploys with one pod (first pod) and starts service request.

We have a requirement to start new pods other than the first pod (which was created during deployment) based on requests. Those start service request of its own. Let's call these pods P1, P2, P3 and Pn. These new pods are not replicas but are individual services with their own configuration.

So I am planning to build a new operator (second operator) which starts working post deployment of the first operator and will create new pods during runtime. But I am stuck at logic to achieve this. Can someone give me some idea to achieve this?

-- Nanda K S
go
kubernetes
kubernetes-pod
operator-keyword
runtime

1 Answer

12/16/2020

Creating K8s deployments dynamically, e.g. triggered by service calls. is nothing that K8s supports out of the box.

You will have to come up with an application that has extensive RBAC rights, as well as the means to store K8s configuration and deploy that configuration on demand, e.g. once a REST endpoint was called.

Since this is a requirement that regularly pops up, I have created an open-source project that shows how it can be done. Please feel free to use this as inspiration or directly.

-- Fritz Duchardt
Source: StackOverflow