Services can be discovered through two principal modes:
Environment variables
DNS
Every Pod gets environment variables for each of the active Services. They are provided in the same format as what Docker links expect, as well with the simpler Kubernetes-specific syntax.
Let’s take a look at the environment variables available in one of the Pods we’re running i.e. go-demo-2-db.
Let's get environment variables for go-demo-2-db