الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 2الاسم في الدورة: Repository structure

Design the repositories and environments

A good layout makes changes easy to review and environments easy to compare. Separate app code from deployment config, use one base with overlays per environment, and keep cluster-wide add-ons apart from apps.

  • 4 الدروس
  • 2 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

2.1

Separate code and config

The app repository builds images. The config repository says which image runs where.

RepositoryContainsChanged by
shop (app)Code, Dockerfile, tests, CIDevelopers
shop-deploy (config)Kubernetes YAML, Helm values, Kustomize overlaysCI (image tag bumps) and reviewers
platform (cluster)Ingress controller, cert-manager, monitoring, policiesPlatform team

2.2

Use base and overlays

One base, small differences per environment with Kustomize (see Kustomize).

shop-deploy layout
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.yaml
kubectl kustomize overlays/prod | less
diff <(kubectl kustomize overlays/staging) <(kubectl kustomize overlays/prod)

2.3

Choose branches or folders for environments

Use folders per environment on one main branch. Branches per environment drift apart and are hard to compare.

ApproachVerdict
One branch, a folder per environmentRecommended: easy diff, one history
A branch per environmentAvoid: merges between environments, hidden differences
A repository per environmentOnly for strict separation (different teams or clouds)

2.4

Use Helm charts in GitOps

Keep the chart version and your values in Git; the GitOps tool renders and applies them.

platform layout
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.

كل الأوامر في هذا الفصل