I have two K8s services A and B running. When service B pods come up, I have to trigger some bash script that executes on service A pods. How we can achieve that ?
Actual case: when service B pods scales, the init container of service B pods will perform some action on service A pods.
You can't directly run scripts or other code in other pods. You need to make network calls to cause things to happen. The use case you describe sounds a little unusual, and a better way to do it might be to use the Kubernetes API in service A to watch for B pods, or to query the Service object for B to find out what pods are present when you need to know that.