I've explored k8s, yet couldn't find an answer to a not trivial setup I have.
I have 2 apps (2 containers) which work together but not related.
app1
receives and filters data, then sends to app2
.
deployment
per application;POD
) because they shouldn't share anything - communication take place on standard network.-> Q1 is this approach correct ?
So I have 2 deployments corresponding to these 2 apps. Defined in deployment1.yaml
and deployment2.yaml
.
Each could scale independently with kubectl scale
.
My two deployments should work together, so in case of scale I would like to:
deployment1
and deployment2
-> Q2 Is there a way to perform multi deployment scale with k8s
?
deployment1
so it would know of new instance of deployment2
existence (ip address, etc...). i.e. I would like to send some request to it with deployment2
ip. -> Q3 Is there a way to have some kind of hook for after-successful-scale
in order to run some code? e.g. bash script? If there is - who runs it? the master node? Some init container?
Regardless of 3.
I would like also deployment1
to pull its configuration from somewhere when it starts. Or alternatively somehow attach files to it when it starts.
-> Q4 Is there a way to do it dynamically? First instance of deployment1
might have different configuration than the second instance. I understand I might use StatefulSets instead of Deployments so I would recognize unique instance.
I thought of using some shared volume / ConfigMap so all instances would read their own unique configuration with their instance number. But I also thought there's a more standard way to do it, so I ask.
I thought what is the way to perform these requirements in the trivial setup of web apps, and thought:
deployments
scale automatically when need to according to some trigger. deployments
export a LoadBalancer, so app1
always talks to app2
's LoadBalancer - then deployment1
is really independent from deployment2
; both scale and LoadBalancer handles the load. -> Q5 Is that thought correct for the trivial case?
The more I look at it, the more I understand K8S
directly isn't the answer to my requirements.
I'm implementing a VNF
so I need another layer of abstraction.
Currently I'm looking at OSM which from couple of first glances looks like it has what I need.
I'll try to update after I know more.