-1

I have two charts in helm.

Chart A (service.type=LoadBalancer)
Chart B (service.type=NodePort)

Env of Chart A has uri of Chart B

Env of Chart B has uri of Chart A

When I install Chart A with env (URI of chart B), it gives dynamic node ip and node port for chart A. Then I install Chart B with env (URI of chart A), it gives dynamic node ip and node port for chart B.

But old node ip and node port of Chart B is present in the chart A env.

If I update it in chart A env and reinstall, it gives new dynamic node ip and node port for chart A which is not present in chart B.

Is there any possible way to resolve this issue?

David Maze
  • 130,717
  • 29
  • 175
  • 215

1 Answers1

3

Instead of using the IP address as env, use the service's DNS address.

Let's say, Chart-A has a service named service-A on namespace demo. You can connect to service-A from any namespace of the cluster on service-A.demo.svc. You don't need to worry while upgrading or reinstalling Chart-A, just make sure that the service's name remains the same.

URL formal: <service-name>.<namespace>.svc:PORT

Kamol Hasan
  • 12,218
  • 1
  • 37
  • 46
  • Thankyou @Kamol Hasan Initially I didn't aware of service DNS. We can access any service through DNS if service.type is clusterIP and clusterIP is set to be None `clusterIP: None` _Related links:_ https://stackoverflow.com/questions/59559438/retrieve-the-full-name-of-a-service-in-kubernetes] https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/] – vignesh5698 Jun 19 '20 at 14:15
  • @vignesh5698 when you use the DNS address of a headless service (`clusterIP: None`), it returns a set of IPs. So, you need to handle this case too. – Kamol Hasan Jun 20 '20 at 13:57