BM: Baca dalam Bahasa Melayu
World K7: Self-Driving
Self-heal and drift
You will learn: what drift is, and how self-heal or Sync puts Git's version back.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
kind-dev namespace defaultGit asks for 3 trays. The cluster runs 1. The floor no longer matches the order board. This gap is called drift: The floor no longer matches the order board: the cluster differs from Git, often after a change by hand..
Try it
Self-heal is on. Make a manual change with the kubectl button. Then watch.
Change the cluster by hand. Then get that change undone.
Git (the order board)
apps/shop/deployment.yaml
Show the whole file
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop
namespace: shop
spec:
replicas: 3
selector:
matchLabels:
app: shop
template:
metadata:
labels:
app: shop
spec:
containers:
- name: web
image: ghcr.io/kedai-kancil/shop:1.4.0
Commits
f89a8e9Add shopin the cluster
Cluster · namespace shop
Sync: SyncedHealth: Healthy
Deployment shop: 3/3 ready · image 1.4.0
syncPolicy:
automated:
selfHeal: trueShow the Argo CD Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: shop
namespace: argocd
spec:
project: default
source:
repoURL: "https://github.com/kedai-kancil/gitops.git"
path: apps/shop
targetRevision: main
destination:
server: "https://kubernetes.default.svc"
namespace: shop
syncPolicy:
automated:
selfHeal: true
Hint
Press the kubectl scale button under “Manual change”.Predict
Now self-heal: Argo CD puts Git's version back by itself when someone changes the cluster by hand. is off. Someone scales to 1 by hand. What happens?
Pick one answer.
Try it
Self-heal is off. Make the manual change, then undo it yourself.
Change the cluster by hand. Then get that change undone.
Git (the order board)
apps/shop/deployment.yaml
Show the whole file
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop
namespace: shop
spec:
replicas: 3
selector:
matchLabels:
app: shop
template:
metadata:
labels:
app: shop
spec:
containers:
- name: web
image: ghcr.io/kedai-kancil/shop:1.4.0
Commits
f89a8e9Add shopin the cluster
Cluster · namespace shop
Sync: SyncedHealth: Healthy
Deployment shop: 3/3 ready · image 1.4.0
syncPolicy:
automated:
selfHeal: falseShow the Argo CD Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: shop
namespace: argocd
spec:
project: default
source:
repoURL: "https://github.com/kedai-kancil/gitops.git"
path: apps/shop
targetRevision: main
destination:
server: "https://kubernetes.default.svc"
namespace: shop
syncPolicy:
automated:
selfHeal: false
Hint
After the manual change, press Sync now.Try it
This cluster has no GitOps helper. Be the helper. Find the drift, then put the file’s version back.
kind-dev namespace defaultWant 1. See 1. All good.
dev-control-planeOpenManagerNo trays here.
dev-workerOpen- shop·grxfr
dev-worker2OpenNo trays here.
Hint
kubectl get deployment shop shows it. kubectl apply -f shop.yaml fixes it.Check
Swipe: good habit or not?
Swipe right for good, left for needs work. Or use the buttons.
Fix production by hand at 2 a.m., and never commit it.
You did it!
You can now spot drift and get Git’s version back.
Go deeper (optional)
Self-heal waits 5 seconds by default before it syncs again. Some drift is on purpose: an autoscaler changes replicas. Tell Argo CD to ignore that field with ignoreDifferences. Real rep (optional): on a kind cluster, kubectl scale a Deployment, then kubectl apply -f its file. See the count snap back.
Bahasa Melayu
Git minta 3 dulang. Kluster jalankan 1. Lantai gerai tak lagi sama dengan papan pesanan. Jurang ini dipanggil drift (hanyut).
Self-heal dihidupkan. Buat perubahan manual dengan butang kubectl. Kemudian perhati.
Sekarang self-heal (pulih sendiri) dimatikan. Seseorang scale kepada 1 secara manual. Apa jadi?
Self-heal dimatikan. Buat perubahan manual, kemudian undurkannya sendiri.
Kluster ini tiada pembantu GitOps. Jadilah pembantu itu. Cari drift, kemudian kembalikan versi dalam fail.
kubectl get deployment shop tunjukkannya. kubectl apply -f shop.yaml baikinya.Leret: tabiat baik atau tidak?
Kini anda boleh kesan drift dan kembalikan versi Git.
You finished this before. Practice is always welcome!
Official docs: Argo CD: automated sync and self-heal · Argo CD: diffing (ignore differences) · kubectl apply
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?