We checking different hypothesizes to warm up a JVM container that is hosted in a pod on a Kubernetes cluster. One of them is using second container within the same pod to leverage shadow traffic dump and send requests to the main application.
k8s several types of container in pods:
- Init container.
- Sidecar containers.
But looks like both of them is not suitable for such purpose, init container should be launched before the main container and must be terminated before the main container. Sidecars looks good and we can send traffic to main app, but they can terminated automatically because of restarting(we don't want to touch deployment.yaml to remove it).
Is there a way to configure a second container to run some task and to stop right after that without restarting? Or maybe some other way to run some task after container is ready?