Cloud Native 9 min read

Deploy Kubernetes Apps with ArgoCD, Git and Helm – Full Step‑by‑Step Guide

This guide walks you through installing ArgoCD on a Kubernetes cluster, creating a Helm chart, defining ArgoCD Application manifests, pushing resources to a Git repository, and using the ArgoCD UI to deploy, sync, and update applications, including version and replica changes via GitOps.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Deploy Kubernetes Apps with ArgoCD, Git and Helm – Full Step‑by‑Step Guide

Preface

ArgoCD is a Kubernetes‑based GitOps continuous delivery tool that synchronizes application deployment and updates directly from a Git repository and provides a visual UI.

ArgoCD UI
ArgoCD UI

Install ArgoCD

Prepare a Kubernetes cluster and apply the official YAML manifest.

# Create namespace
kubectl create namespace argocd

# Deploy ArgoCD
wget https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl apply -n argocd -f install.yaml

# Check status
kubectl get pod -n argocd -w

# Change service to NodePort for UI access
kubectl -n argocd edit svc argocd-server

Access the UI; the address automatically redirects to HTTPS.

# Get initial admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

The default admin password is random; you can replace it with a bcrypt‑encoded value.

# Replace admin password
kubectl -n argocd patch secret argocd-secret \
  -p '{"stringData": {"admin.password":"$2a$10$...","admin.passwordMtime":"'$(date +%FT%T%Z)'"}}'

Prepare a Helm chart

ArgoCD supports Helm, Kustomize, and other templating tools. Here we create a simple Helm chart.

# Create directory and init git
mkdir gitops && cd gitops && git init
mkdir -p {helm,argocd} && cd helm

# Add a Helm chart (tree -L 2)
app1/
  Chart.yaml
  templates/
    deployment.yaml
    service.yaml
  values.yaml

Chart.yaml

apiVersion: v2
appVersion: "1.0"
name: app1
description: app1 for kubernetes
type: application
version: 0.1.0

values.yaml

global:
  replicas: 2
image:
  repository: harbor.example.cn/public/nginx
  tag: stable-alpine

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
  namespace: {{ .Release.Namespace }}
spec:
  replicas: {{ .Values.global.replicas }}
  selector:
    matchLabels:
      demo: app1
  template:
    metadata:
      labels:
        demo: app1
    spec:
      containers:
      - name: nginx
        image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
        ports:
        - containerPort: 80
          name: http

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: app1-svc
  namespace: {{ .Release.Namespace }}
  labels:
    demo: app1
spec:
  type: ClusterIP
  selector:
    demo: app1
  ports:
  - port: 80
    name: http
    targetPort: http
    protocol: TCP

Define ArgoCD Application manifests

Create separate directories for dev, test, pre, prod and place an Application.yaml in each.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: demo-argocd
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://git.example.com/gitops/gitops1.git
    targetRevision: HEAD
    path: helm/app1
    helm:
      parameters:
      - name: image.repository
        value: harbor.example.cn/public/nginx
      - name: image.tag
        value: stable-alpine
      - name: global.replicas
        value: "2"
  destination:
    server: https://kubernetes.default.svc
    namespace: demo
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
    - Validate=false
    - CreateNamespace=true
    - PrunePropagationPolicy=foreground
    - PruneLast=true
    retry:
      limit: 5
      backoff:
        factor: 2
        maxDuration: 1m

Push the directory to a Git repository.

# Directory layout
gitops/
  argocd/
    dev/Application.yaml
    test/Application.yaml
    pre/Application.yaml
    prod/Application.yaml
  helm/
    app1/
      Chart.yaml
      templates/
      values.yaml

# Push to Git
git init
git add .
git commit -m "Add ArgoCD and Helm resources"
git remote add origin <repo-url>
git push -u origin master

Integrate with ArgoCD UI

Log in to the ArgoCD UI, add the Git repository, and create an application that points to the Helm chart.

Add repository UI
Add repository UI
Create application UI
Create application UI

After creating the application, manually sync it the first time, then enable automated sync for the production environment.

Version update

To update the service version, edit the corresponding Application.yaml (e.g., change image.tag or global.replicas) and push the change to Git; ArgoCD will detect the change and apply it to the cluster.

# Example: update image tag and replica count
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: demo-argocd
  namespace: argocd
spec:
  source:
    helm:
      parameters:
      - name: image.repository
        value: harbor.example.cn/public/nginx
      - name: image.tag
        value: v1.0.0   # new version
      - name: global.replicas
        value: "1"      # change replica count
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

ArgoCD automatically synchronizes the updated configuration to the Kubernetes cluster.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeKubernetesContinuous DeliveryGitOpshelmArgoCD
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.