1.

How should you connect an app pod with a database pod?

Answer»

By using a service object. reason being, if the database pod goes away, it's going to come up with a DIFFERENT name and IP address. Which means the connection string would need to be updated every TIME, managing that is difficult. The service proxies traffic to pods and it also helps in load balancing of traffic if you have multiple pods to talk to. It has its own IP and as LONG as service exists pod REFERENCING this service in upstream will work and if the pods behind the service are not running, a pod will not see that and will try to FORWARD the traffic but it will return a 502 bad gateway.So just defined the Service and then bring up your Pods with the proper label so the Service will pick them up.



Discussion

No Comment Found

Related InterviewSolutions