Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Hoofdstuk 2Naam in de cursus: 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 Lessen
  • 2 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met 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/

Onthoud

Pin chart versions. An unpinned chart can change the cluster without any commit in your repository.

Alle commando's in dit hoofdstuk