Dmytro Zhluktenko
Dmytro Zhluktenko

Reputation: 160

What should be the name pattern for k8s service?

I was wondering what is the best name pattern for a service object in k8s environment. Should it be %service-name%-service or just %service-name%?

workflow-service or just workflow?

What are the arguments for both sides?

Upvotes: 0

Views: 901

Answers (3)

P Ekambaram
P Ekambaram

Reputation: 17615

In kubernetes the service dns follow the below pattern

<service-name>.<namespace-name>.svc.cluster.local

i have seen people using svc or service appended to the service name with '-' as the delimiter like below, say, redis

  1. redis-service
  2. redis-svc
  3. redis

all the three are perfectly fine but the first one makes more sense interms of readability and standard way of representing the service object.

Upvotes: 3

Markus Dresch
Markus Dresch

Reputation: 5574

this is simply a matter of taste. if you want verbosity, add -service. but since resources are separate anyway, why be verbose.

Upvotes: 0

Navya Teja
Navya Teja

Reputation: 23

In fact, while creating a service it is not needed to append "-service" in the name. The general way of doing it is to name the service same as the name of the pods it is pointing to. Hope this helps.

Thank you!

Upvotes: 0

Related Questions