How to designate the constul namespace when calling the constul service in the template in the nomad job

I am a user who enjoys using consul and nomad.

This time, namespace is applied to logically divide services.

When running nomad job

consul {
namespace = “prd”

It was well applied using the same stencil.

And this time I have an additional question. I was load balancing a service through nginx job and I want to call a service in a specific namespace (prd) from nginx job.

What I was thinking of was the following.

upstream backend {
{{ range service “namespace.serivcename” }}
server {{ .Address }}:{{ .Port }};
{{ else }}server; # force a 502
{{ end }}

I thought it would be called with namespacename.servicename like this, but I found that it didn’t work as expected.

Please let me know if there is anything I need to modify in the template area in my nomad job in this situation.

thank you