Search code examples
kuberneteskubernetes-helmhelmfile

How to move Service into the helmfile?


I have the following helmfile.yaml:

---
repositories:
  - name: bitnami
    url: https://charts.bitnami.com/bitnami

releases:
  - name: clickhouse
    namespace: clickhouse
    chart: bitnami/clickhouse
    version: 5.0.1
    values:
      - values.common.yaml

environments:
  data-ehp:
    values:
  data-prod:
    values:

I want to deploy the following service with it clickhouse-svc.yaml:

apiVersion: v1
kind: Service
metadata:
  name: clickhouse-svc
  annotations:
    networking.gke.io/load-balancer-type: "Internal"
spec:
  type: LoadBalancer
  externalTrafficPolicy: Cluster
  selector:
    statefulset.kubernetes.io/pod-name: clickhouse-shard0-0
  ports:
  - name: http-port
    protocol: TCP
    port: 8123
    targetPort: 8123
  - name: tcp-port
    protocol: TCP
    port: 9000
    targetPort: 9000
  - name: mysql-port
    protocol: TCP
    port: 9004
    targetPort: 9004
  - name: postgresql-port
    protocol: TCP
    port: 9005
    targetPort: 9005

How can I add the service into my helmfile ?


Solution

  • Try to update helmfile.yaml as below

    ---
    repositories:
      - name: bitnami
        url: https://charts.bitnami.com/bitnami
    
    releases:
      - name: clickhouse
        namespace: clickhouse
        chart: bitnami/clickhouse
        version: 5.0.1
        values:
          - values.common.yaml
    
      - name: clickhouse-svc
        namespace: clickhouse
        chart: path/to/service/chart  # Replace with the actual path to your service chart if it's packaged separately. 
        version: 1.0.0  # Update the version as needed
        values:
          - clickhouse-svc.yaml
    
    environments:
      data-ehp:
        values:
      data-prod:
        values:
    

    If you don't have chart, create one using 'helm create custom-clickhouse'
    it will create the chart for you, update the values.yaml with desired ports and oth changes then update your helmfile.yaml to the path of chart