2

Leveraging Kustomize to Render Helm Charts and Deploying via ArgoCD

 2 months ago
source link: https://www.bboy.app/2024/03/18/leveraging-kustomize-to-render-helm-charts-and-deploying-via-argocd/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Leveraging Kustomize to Render Helm Charts and Deploying via ArgoCD

March 18, 2024 本文有 247 个字 需要花费 2 分钟阅读
20240318-1.webp

Introduction

Although I have my reservations about using Helm, there are times when it’s unavoidable. In this article, I’ll introduce a method that allows Kustomize and Helm to work together, addressing my dissatisfaction with Helm.

Procedure

Previously, when I deployed with Helm, I had to pull down the entire Helm charts, modify the values.yaml, commit, and then deploy. This process was quite cumbersome. However, Kustomize supports direct rendering of Helm charts. You can refer to the following documentation:

https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/helmcharts/

For specific parameters, you can refer to the following link:

https://kubectl.docs.kubernetes.io/references/kustomize/builtins/#_helmchartinflationgenerator_

Then, you just need to add the --enable-helm parameter at compile time.

For instance, for a project, if I want to deploy a Dragonfly, it becomes incredibly simple. I only need three files, the first one being kustomization.yaml:

helmCharts:
- name: dragonfly
  repo: https://dragonflyoss.github.io/helm-charts/
  version: 1.1.32
  releaseName: dragonfly
  namespace: dragonfly
  valuesFile: values.yaml

Next is the values.yaml file, which I won’t display here.

Finally, the argo.yaml:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: 'dragonfly'
spec:
  destination:
    namespace: 'dragonfly'
    server: 'https://xxxxxxxxxxxxxxxxxxx.gr7.us-west-2.eks.amazonaws.com'
  source:
    path: 'dragonfly'
    repoURL: 'https://git.xxxxx.com/kubernetes-app-yaml.git'
    targetRevision: HEAD
  project: 'app'

Next, enable Helm support for Kustomize on ArgoCD. You can refer to the following link for specific operations:

https://argo-cd.readthedocs.io/en/release-2.8/user-guide/kustomize/#kustomizing-helm-charts

In reality, you just need to add the following content to the argocd-cm ConfigMap:

kustomize.buildOptions: --enable-helm

If you need to update your charts, simply modify the version of the charts directly. All parameters are under your control, making it very convenient.

Feel free to follow my blog at www.bboy.app

Have Fun


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK