EN: Read in English
Dunia K7: Pandu Sendiri
Kemas kini image automatik
Anda akan belajar: cara robot kesan tag image baharu dan commit ke Git untuk anda.
Teks BM belum disemak oleh penutur asli.
Disemak dengan Kubernetes 1.37 pada 31 Okt 2026
Masalahnya
Pipeline anda hantar image baharu setiap kali merge: 1.5.0, 1.5.1, 1.5.2. Setiap kali, seseorang edit baris image dalam Git secara manual. Siapa patut buat kerja bosan ini?
Pilih satu jawapan.
Cuba
Robot ini dipanggil image automation (automasi image) (image automation): Robot yang nampak tag image baharu dalam registry dan commit ke Git untuk anda. (automasi image). Susun gelungnya.
Langkah pertama di atas. Susun ikut turutan. Guna anak panah, atau seret.
- Robot nampak tag baharu
- Robot commit tag baharu ke Git
- Argo CD atau Flux sync commit itu
- Pod baharu jalankan 1.5.0
- CI push shop:1.5.0 ke registry
Cuba
Jadilah robot itu. Tag baharu dah sampai di registry. Pilih tag itu, kemudian commit.
Tukar satu baris dalam Git dan commit. Lihat kluster mengikutnya.
Git (papan pesanan)
apps/shop/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.5.0
Commit
f89a8e9Add shopdalam kluster
Kluster · namespace shop
Sync: SyncedHealth: Healthy
Deployment shop: 3/3 sedia · image 1.5.0
syncPolicy:
automated:
selfHeal: trueTunjuk Application Argo CD
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
Petunjuk
Pilih shop:1.5.1 dalam senarai image, kemudian Commit ke Git.Tengok
Flux cari baris yang perlu ditukar melalui komen penanda. Tekan baris yang robot tulis semula.
Tekan baris yang ada penanda.
0 daripada 1 dijumpai
Semak
Polisi itu benarkan >=1.5.0 <2.0.0. Leret ke kanan untuk tag yang robot boleh pilih.
Leret ke kanan untuk bagus, ke kiri untuk perlu baiki. Atau guna butang.
1.5.2Teka
Kenapa robot patut commit ke Git, bukan ubah kluster terus?
Pilih satu jawapan.
Anda berjaya!
Kini anda boleh biar robot hantar tag image baharu melalui Git.
Nak tahu lebih (pilihan)
Flux guna tiga objek: ImageRepository (imbas), ImagePolicy (pilih) dan ImageUpdateAutomation (commit). Argo CD Image Updater juga boleh commit ke Git. Dokumennya kata ia masih dalam pembangunan aktif, jadi uji dulu. Alat seperti Renovate buka pull request pula. Latihan sebenar (pilihan): baca panduan kemas kini image Flux.
English
Your pipeline ships a new image every merge: 1.5.0, 1.5.1, 1.5.2. Each time, someone edits the image line in Git by hand. Who should do this boring job?
This robot is called image automation. Put its loop in order.
Be the robot. A new tag landed in the registry. Pick it, then commit.
Flux finds the line to change by a marker comment. Tap the line the robot rewrites.
The policy allows >=1.5.0 <2.0.0. Swipe right on tags the robot may pick.
Why should the robot commit to Git, not change the cluster directly?
You can now let a robot ship new image tags through Git.
Anda dah siapkan ini. Latihan lagi pun bagus!
Dokumentasi rasmi: Flux: automate image updates to Git · Argo CD Image Updater
Anda dah belajar 25 minit. Rehat sekejap bantu otak anda.
Pecutan selesai! Fokus yang hebat. Regangkan badan seminit?