How-to & Guides ยท How-to
How to Implement GitOps Delivery for Kubernetes
Implement secure, observable GitOps reconciliation and promotion for Kubernetes workloads across AKS, EKS, GKE, and OKE.
Document class: How-to Guides implementation guide Normative terms: MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY are requirements levels. Applicability: GitOps reconciliation, promotion, workload identity, policy, observability, and rollback for AKS, EKS, GKE, and OKE. Exception process: Deviations require a documented risk assessment, compensating controls, named risk owner, and expiry date.
| Control field | Value |
|---|---|
| Document ID | HTG-15 |
| Owner | Cloud Center of Excellence |
| Review cycle | At least annually and after material Kubernetes, GitOps, or policy changes |
| Evidence | Commit and signature, manifest diff, policy results, reconciliation status, health metrics, promotion approval, and rollback evidence |
Decision in brief: Make Git the auditable desired state, reconcile through a constrained controller, and promote only verified commits with a reversible path.
Document type: Implementation guide Primary examples: AKS with Flux or Argo CD Cloud scope: Azure, AWS, GCP, and Oracle Cloud Infrastructure (OCI) Operating principle: Git records desired state; a constrained in-cluster controller continuously reconciles it.
Objective
Deliver Kubernetes configuration declaratively without giving a central pipeline broad, persistent cluster credentials. The design separates application source from environment configuration, promotes immutable artifact digests, enforces pull-request controls, detects drift, and provides a tested suspension and recovery procedure.
Preconditions
- A supported Kubernetes cluster with private administrative access.
- A Git service with protected branches, required review, and signed or attributable changes.
- An immutable container and Helm/OCI registry.
- A secrets-delivery method that stores no plaintext secret in Git.
- Policy, admission, logging, alerting, and cluster backup baselines.
- Named owners for platform configuration, application configuration, and production approval.
Architecture
The CI pipeline may propose a configuration change but does not directly modify the cluster. The reconciler reads only approved paths and has only the permissions required for those resources.
Design the repositories
Use separate lifecycle boundaries:
application-repository/
src/
Dockerfile
charts/orders-api/
environment-repository/
clusters/
development/
staging/
production/
platform/
workloads/
orders-api/
base/
overlays/
Avoid a branch-per-environment model when branches obscure the promotion diff. Environment directories on a protected main branch usually provide a clearer audit trail. Separate repositories when teams, privileges, retention, or change cadence materially differ.
Bootstrap the controller
- Install Flux or Argo CD from a pinned, verified release.
- Scope the controller to approved namespaces and resource types.
- Configure read-only Git authentication using a deploy key, GitHub App, or workload identity where supported.
- Restrict repository URLs and disallow unapproved Helm or manifest sources.
- Enable signature or provenance verification for deployable artifacts.
- Set reconciliation intervals, timeouts, retries, health checks, and dependency order.
- Send reconciliation, audit, and Kubernetes events to central telemetry.
- Back up controller configuration and document re-bootstrap from Git.
Do not grant cluster-admin to tenant controllers. Use a platform controller for cluster-scoped resources and namespace-scoped controllers or service accounts for tenant workloads.
Normalize manifests
Every production workload should declare:
- image by digest, not a mutable tag;
- requests, limits, probes, disruption budget, and autoscaling policy;
- service account with workload identity and no mounted legacy token unless required;
- network policy and approved ingress/egress paths;
- pod security settings and read-only filesystem where compatible;
- topology spread or anti-affinity for the required availability objective;
- external secret references rather than secret values;
- owner, application, environment, criticality, and cost metadata.
Use Helm, Kustomize, or equivalent templating consistently. Render and validate the final manifests in CI so reviewers see effective changes.
Manage secrets
Use Azure Key Vault, AWS Secrets Manager, Google Secret Manager, or OCI Vault with a CSI driver or external-secrets controller. Authenticate through Kubernetes workload identity. If encrypted secrets in Git are approved, separate decryption keys by environment, restrict controller access, and test key recovery and rotation.
Never commit base64-encoded Kubernetes Secret values; base64 is not encryption.
Promote changes
- CI builds and signs one image and records its digest.
- Automated tests and scans qualify the artifact.
- CI opens a pull request changing the development manifest to that digest.
- Reconciliation deploys it; health and integration tests create evidence.
- A new reviewed pull request promotes the same digest to staging, then production.
- Production approval binds the digest, configuration commit, cluster, and change window.
- Post-deploy verification confirms rollout, application health, SLOs, and business transactions.
Do not copy unreviewed environment configuration forward. Promote an explicit diff and retain environment-specific values.
Handle drift and emergencies
Classify drift before acting:
| Drift type | Response |
|---|---|
| Unauthorized manual change | Reconcile, investigate identity and audit logs, remove excess access |
| Emergency approved change | Record incident/change, apply temporary change, back-port immediately to Git |
| Controller defect | Suspend affected reconciliation scope, preserve evidence, fix and resume |
| Invalid desired state | Revert the Git commit or promote a corrected commit |
| External mutation | Update admission policy or controller ownership to prevent conflict |
Provide a break-glass process with time-limited access, named approval, full audit logging, and mandatory reconciliation back to Git. Never disable all reconciliation to resolve one failing application.
Multi-cloud mapping
| Capability | Azure | AWS | GCP | OCI |
|---|---|---|---|---|
| Managed Kubernetes | AKS | EKS | GKE | OKE |
| Workload identity | Entra workload identity | IAM roles for service accounts or Pod Identity | Workload Identity Federation for GKE | OKE workload identity |
| Secret store | Key Vault | Secrets Manager | Secret Manager | Vault |
| Artifact registry | ACR | ECR | Artifact Registry | OCIR |
| Managed GitOps option | AKS Flux extension | Controllers on EKS | Config Sync or controllers on GKE | Controllers on OKE |
Keep the repository contract and promotion evidence provider-neutral even when controller installation and identity bindings are provider-specific.
Validation
- A Git change creates the expected cluster change within the service objective.
- A manual managed-resource change is detected and reconciled or alerted.
- An unapproved repository, unsigned artifact, mutable tag, or plaintext secret is rejected.
- Tenant reconciliation cannot create cluster-scoped resources or modify another namespace.
- A failed rollout stops promotion and exposes useful health evidence.
- Reverting the configuration commit restores the known-good digest.
- Controller loss can be recovered from Git and documented bootstrap material.
- Break-glass access expires and every emergency change is back-ported.
Completion criteria
GitOps is ready when approved Git state is authoritative, reconciliation permissions are bounded, artifacts are immutable and verified, secrets remain external, environment promotion is evidence-based, drift and controller health are observable, and rollback and re-bootstrap are tested.
Operational boundaries and acceptance criteria
Before adopting this guidance, record the accountable service owner, supported environments, critical dependencies, data classification, and the operational tier. State which decisions belong to the platform team and which remain with the workload team; document any exception with a risk owner and expiry date. This prevents a reference pattern from being treated as a universal fit.
Define observable acceptance checks before rollout. Include a positive path, a denied or invalid request, a dependency failure, and recovery after the failure clears. Capture the configuration or command output that proves each check, along with the software and policy versions used. Make checks repeatable in a representative non-production environment, and ensure they fail closed when required evidence is missing.
For production changes, identify the safe rollback or forward-recovery action, the person authorized to invoke it, and the condition that triggers it. Confirm that monitoring, support ownership, capacity limits, and escalation contacts are in place before declaring the change complete. Review these assumptions after a material platform, provider, or regulatory change.
Workload failure domains and upgrade safety
Treat a cluster as a shared failure domain only when its identity, network, storage, and administrative boundaries match the workload's risk. Spread replicas across independent zones where available, use disruption budgets for voluntary maintenance, and keep readiness separate from liveness so a dependency outage does not trigger restart storms. Set CPU and memory requests from measured demand, then test limits under realistic load; throttling and memory pressure can make a nominally healthy pod unavailable.
Before changing Kubernetes or an add-on, compare deprecated API usage, admission policies, CSI and CNI compatibility, node-image support, and workload disruption. Upgrade a representative canary first, observe scheduling and error rates, and retain a tested rollback or node-pool replacement path.