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.
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.
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-serverAccess 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 -dThe 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.yamlChart.yaml
apiVersion: v2
appVersion: "1.0"
name: app1
description: app1 for kubernetes
type: application
version: 0.1.0values.yaml
global:
replicas: 2
image:
repository: harbor.example.cn/public/nginx
tag: stable-alpinedeployment.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: httpservice.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: TCPDefine 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: 1mPush 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 masterIntegrate with ArgoCD UI
Log in to the ArgoCD UI, add the Git repository, and create an application that points to the Helm chart.
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: trueArgoCD automatically synchronizes the updated configuration to the Kubernetes cluster.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
