Is it possible to dynamically add a new pod to an existing deployment?

7/31/2019

Just to be clear: I'm not asking about scaling up the number of replicas of a pod - I'm asking about adding a new pod which provides completely new functionality.

So I'm wondering: can I call the Kubernetes API to dynamically add a new pod to an existing deployment?

-- caleb
kubernetes

2 Answers

8/1/2019

You can inject a container to an existing Pod. Not sure whether it would meet your requirement. You can refer to how istio inject a sidecar proxy to an existing Pod manually. Manual injection

-- Hang Du
Source: StackOverflow

7/31/2019

Deployments are meant to be a homogeneous set of replicas of the same pod template, each presumably providing the same functionality. Deployments keep the desired number of replicas running in the event of crashes and other failures, and facilitate rolling updates of the pods when you need to change configuration or the version of the container image, for example. If you want to run a pod that provides different functionality, do so via a different deployment.

Adding a different pod to an existing deployment is not a viable option. If you want to spin up pods in response to API requests to do some work, there are a handful of officially support client libraries you can use in your API business logic: https://kubernetes.io/docs/reference/using-api/client-libraries/#officially-supported-kubernetes-client-libraries.

-- Amit Kumar Gupta
Source: StackOverflow