هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
Separate code and config
The app repository builds images. The config repository says which image runs where.
| Repository | Contains | Changed by |
|---|---|---|
shop (app) | Code, Dockerfile, tests, CI | Developers |
shop-deploy (config) | Kubernetes YAML, Helm values, Kustomize overlays | CI (image tag bumps) and reviewers |
platform (cluster) | Ingress controller, cert-manager, monitoring, policies | Platform team |
Use base and overlays
One base, small differences per environment with Kustomize (see Kustomize).
shop-deploy/
├── base/
│ ├── deployment.yaml
│ ├── service.yaml
│ └── kustomization.yaml
└── overlays/
├── staging/
│ └── kustomization.yaml (1 replica, staging image tag)
└── prod/
├── kustomization.yaml (4 replicas, prod image tag, HPA)
└── hpa.yamlChoose branches or folders for environments
Use folders per environment on one main branch. Branches per environment drift apart and are hard to compare.
| Approach | Verdict |
|---|---|
| One branch, a folder per environment | Recommended: easy diff, one history |
| A branch per environment | Avoid: merges between environments, hidden differences |
| A repository per environment | Only for strict separation (different teams or clouds) |
Use Helm charts in GitOps
Keep the chart version and your values in Git; the GitOps tool renders and applies them.
platform/
├── ingress-nginx/
│ ├── values.yaml
│ └── application.yaml (chart repo, chart version 4.11.3, values file)
├── cert-manager/
└── monitoring/تذكّر
Pin chart versions. An unpinned chart can change the cluster without any commit in your repository.