Joe
Joe

Reputation: 693

Could service port be the same in Kubernetes

In kubernetes, I have an application pod (A-pod), then I create a service (A-service) for this pod and expose service's port as 5678.

Now in a cluster, I have 5 namespaces, each namespace will running a service (A-service) and a pod (A-pod), so in total there are 5 A-services that are running.

My question is, because 5 A-services is using the same port (5678), does it cause conflict? How to access the different services in different namespace with service name?

Upvotes: 0

Views: 785

Answers (1)

Daein Park
Daein Park

Reputation: 4703

Yes, it assigns each different Service name in each namespace. If you have a Service called A-service in a Kubernetes namespace your-ns, the control plane and the DNS Service acting together create a DNS record for A-service.your-ns appropriately. Refer here for more details.

Upvotes: 2

Related Questions