--- apiVersion: v1 kind: Service metadata: name: "{{ .Values.name }}-service" namespace: {{ .Values.namespace }} spec: selector: app.kubernetes.io/name: {{ .Values.name }} {{- if eq .Values.service.type "LoadBalancer" }} type: LoadBalancer {{- else if eq .Values.service.type "NodePort" }} type: NodePort {{- end }} ports: - {{- if eq .Values.service.type "LoadBalancer" }} port: {{ .Values.service.port }} {{- else if eq .Values.service.type "NodePort" }} nodePort: {{ .Values.service.nodePort }} {{- end }} targetPort: 80 protocol: TCP