Is it allowed to have multi service in helm chart?

5/13/2020

I am pretty newbie in Helm and would like to know, if it is allowed to have multi services in service.yaml file like:

apiVersion: v1
kind: Service
metadata:
  name: {{ include "keycloak.fullname" . }}
  labels:
    {{- include "keycloak.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
  selector:
    {{- include "keycloak.selectorLabels" . | nindent 4 }}

---

apiVersion: v1
kind: Service
metadata:
  name: {{ include "keycloak.fullname" . }}
  labels:
    {{- include "keycloak.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
  selector:
    {{- include "keycloak.selectorLabels" . | nindent 4 }}  
-- zero_coding
kubernetes
kubernetes-helm

1 Answer

5/13/2020

Yes it is, are you facing any issue?

A cleaner way is to use two different files service-a.yaml and service-b.yaml

Note: Better not to have both the services with the same name.

-- Tummala Dhanvi
Source: StackOverflow