What should be the name pattern for k8s service?

3/6/2019

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?

-- Dmytro Zhluktenko
kubernetes
service

3 Answers

3/6/2019

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

-- Markus Dresch
Source: StackOverflow

3/6/2019

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!

-- Navya Teja
Source: StackOverflow

3/6/2019

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.

-- P Ekambaram
Source: StackOverflow