EN: Read in English
Dunia K7: Pandu Sendiri · Cabaran bos
Lepas tangan
Anda akan belajar: jalankan Kedai Kancil dari Git sahaja, kemudian tangkap dan undur suntingan manual.
Teks BM belum disemak oleh penutur asli.
Disemak dengan Kubernetes 1.37 pada 31 Okt 2026
Masalahnya
Waktu puncak, hari Sabtu. Kedai Kancil kini berjalan dengan GitOps. Misi boss: jangan sentuh kluster. Git yang memandu. Anda perlukan lebih banyak dulang. Di mana anda minta?
Pilih satu jawapan.
Cuba
Bilik 1: tukar satu baris dalam Git. Minta 5 dulang, kemudian perhati kluster ikut.
Tukar satu baris dalam Git dan commit. Lihat kluster mengikutnya.
Git (papan pesanan)
apps/kedai-kancil/deployment.yaml
Tunjuk seluruh fail
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
Commit
c7c258eAdd shopdalam kluster
Kluster · namespace shop
Sync: SyncedHealth: Healthy
Deployment shop: 3/3 sedia · image 1.4.0
syncPolicy:
automated:
selfHeal: trueTunjuk Application Argo CD
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kedai-kancil
namespace: argocd
spec:
project: default
source:
repoURL: "https://github.com/kedai-kancil/gitops.git"
path: apps/kedai-kancil
targetRevision: main
destination:
server: "https://kubernetes.default.svc"
namespace: shop
syncPolicy:
automated:
selfHeal: true
Petunjuk
Tekan + dua kali, kemudian Commit ke Git.Cuba
Bilik 2: Argo CD pastikan pesanan sama dengan Git. Deployment pula jaga dulang. Satu dulang jatuh. Perhati gelung dalam membaikinya.
Mahu 5, nampak 5. Satu dulang dipadam: nampak 4, buat 1 lagi.
Mahu 5. Nampak 5. Semua okey.
dev-workerBuka- shop·4j5fz
- shop·k7hl8
- shop·zdbvc
dev-worker2Buka- shop·8slqz
- shop·vblr4
Petunjuk
Tekan butang padam pada satu dulang.Cuba
Bilik 3: hantar versi 1.5.0, cara GitOps.
Tukar satu baris dalam Git dan commit. Lihat kluster mengikutnya.
Git (papan pesanan)
apps/kedai-kancil/deployment.yaml
Tunjuk seluruh fail
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop
namespace: shop
spec:
replicas: 5
selector:
matchLabels:
app: shop
template:
metadata:
labels:
app: shop
spec:
containers:
- name: web
image: ghcr.io/kedai-kancil/shop:1.4.0
Commit
c7c258eAdd shopdalam kluster
Kluster · namespace shop
Sync: SyncedHealth: Healthy
Deployment shop: 5/5 sedia · image 1.4.0
syncPolicy:
automated:
selfHeal: trueTunjuk Application Argo CD
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kedai-kancil
namespace: argocd
spec:
project: default
source:
repoURL: "https://github.com/kedai-kancil/gitops.git"
path: apps/kedai-kancil
targetRevision: main
destination:
server: "https://kubernetes.default.svc"
namespace: shop
syncPolicy:
automated:
selfHeal: true
Petunjuk
Pilih shop:1.5.0 dalam senarai image, kemudian commit.Cuba
Bilik 4: commit rakan sepasukan rosakkan sync. Baca ralat sebenar. Baiki fail itu dalam Git.
Baiki manifest ini, kemudian tekan Apply.
Cuba
Bilik 5: self-heal dimatikan pada aplikasi ini. Seseorang scale secara manual. Tangkap drift itu dan undurkannya.
Tukar kluster secara manual. Kemudian pastikan perubahan itu dibatalkan.
Git (papan pesanan)
apps/kedai-kancil/deployment.yaml
Tunjuk seluruh fail
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop
namespace: shop
spec:
replicas: 5
selector:
matchLabels:
app: shop
template:
metadata:
labels:
app: shop
spec:
containers:
- name: web
image: ghcr.io/kedai-kancil/shop:1.5.0
Commit
c7c258eAdd shopdalam kluster
Kluster · namespace shop
Sync: SyncedHealth: Healthy
Deployment shop: 5/5 sedia · image 1.5.0
syncPolicy:
automated:
selfHeal: falseTunjuk Application Argo CD
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kedai-kancil
namespace: argocd
spec:
project: default
source:
repoURL: "https://github.com/kedai-kancil/gitops.git"
path: apps/kedai-kancil
targetRevision: main
destination:
server: "https://kubernetes.default.svc"
namespace: shop
syncPolicy:
automated:
selfHeal: false
Petunjuk
Tekan butang kubectl, kemudian Sync sekarang. Atau hidupkan self-heal.Semak
Semakan terakhir. Leret: betul atau belum tepat?
Leret ke kanan untuk bagus, ke kiri untuk perlu baiki. Atau guna butang.
Setiap perubahan hari ini ialah commit yang boleh dibaca dan di-revert.
Anda berjaya!
Kini anda boleh jalankan kluster dari Git sahaja, lepas tangan.
English
Lunch rush, Saturday. Kedai Kancil now runs on GitOps. Boss mission: keep your hands off the cluster. Git does the driving. You need more trays. Where do you ask?
Room 1: change one line in Git. Ask for 5 trays, then watch the cluster follow.
Room 2: Argo CD keeps the order the same as Git. The Deployment keeps the trays. A tray falls. Watch the inner loop fix it.
Room 3: ship version 1.5.0, the GitOps way.
Room 4: a teammate’s commit broke the sync. Read the real error. Fix the file in Git.
Room 5: self-heal is off on this app. Someone scales it by hand. Catch the drift and undo it.
Last check. Swipe: true or not quite?
You can now run a cluster from Git alone, hands off.
Anda dah siapkan ini. Latihan lagi pun bagus!
Dokumentasi rasmi: Argo CD: automated sync and self-heal · OpenGitOps: the four principles · Kubernetes: controllers
Anda dah belajar 25 minit. Rehat sekejap bantu otak anda.
Pecutan selesai! Fokus yang hebat. Regangkan badan seminit?