helm with ingress controllers

4/19/2019

We have an application that get created using helm. Every time we do release it creates a service with release name in it. How do we handle in alb-ingress if the service keeps changing ?

ex: for alb ingress(under kops) I have below rule

- host: pluto.example.com
    paths:
      - path: /
        backend:
          serviceName: pluto-service
          servicePort: 8080

With a different helm release pluto-service will have new name. How to handle the ingress ?

-- Ramachandra Bhaskar Ayalavarap
kubernetes
kubernetes-helm

3 Answers

4/19/2019

You can create a service in helm where you pass a different value to the name of the service, most likely you use a release name right now. For example, create a helm chart for your application where you pass the name as a value:

apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.nameOverride }}
spec:
  type: NodePort
  ports:
    - name: http-service
      targetPort: 5000
      protocol: TCP
      port: 80
  selector:
    app: <MyApp>

And in the values.yaml of the chart you can specify the name of your service: nameOverride: MyService

-- Blokje5
Source: StackOverflow

4/22/2019

Is the ingress declared with helm too ?

If so, and if the service use a {{ .Release.Name }}-service as name, you can also use {{ .Release.Name }}-service as ingress' service name. You can also write you own tpl function (and add it to _helpers.tpl file) to determine service name.

If not, maybe you should ...

-- Alexandre Cartapanis
Source: StackOverflow

4/19/2019

You can also try to use '--reuse-values' flag with helm upgrade command. This will reuse the last release`s values.

-- Nepomucen
Source: StackOverflow