Sample microservices for the web and api deployments are maintained at https://github.com/servicemeshbook/hello-echo the main.go is the web microservice, that calls the upstream API microservice through the use of the UPSTREAM_SERVICE environment variable.
Review the pod and service definition in the 11-web-deployment.yaml script:
... template: metadata: labels: app: web annotations: "consul.hashicorp.com/connect-inject": "true" "consul.hashicorp.com/connect-service-upstreams": "api:8081"... env:... - name: UPSTREAM_SERVICE value: "http://localhost:8081"
Note the consul.hashicorp.com/connect-service-upstreams annotation in the preceding definition, which points to the Consul service-defaults primitive api with ...