Skip to content

Repository files navigation

πŸ›‘οΈ DevSecOps GitOps Platform

A production-shaped, security-first Kubernetes platform β€” 100% GitOps, zero-downtime automated blue-green delivery, cryptographically-verified supply chain, and full-stack observability.

GitOps Kubernetes Progressive Delivery Policy Supply Chain Runtime Security Observability


πŸ“– What is this?

This repository is the single source of truth for an end-to-end DevSecOps platform running on Kubernetes. Every workload, policy, dashboard, and route in the cluster is declared here as code β€” a human never runs kubectl apply. Argo CD continuously reconciles the live cluster to match main, so the repository is the deployment.

The platform demonstrates the full DevSecOps lifecycle on real infrastructure:

Commit β†’ CI build β†’ keyless image signing β†’ GitOps sync β†’ policy-gated admission β†’ automated smoke-tested blue-green promotion β†’ runtime detection β†’ full observability.

It is deliberately built the way a real platform team would build one: declarative, auditable, secure by default, and self-healing.


✨ Highlights

Capability How it's implemented
πŸ” Pure GitOps Argo CD app-of-apps β€” one root Application fans out to 11 self-healing Applications. Auto-sync, auto-prune, drift correction.
πŸš€ Zero-downtime delivery Argo Rollouts blue-green with fully automated promotion β€” measured 0 failed requests across a live cutover.
πŸ§ͺ Automated release gates Smoke tests (AnalysisTemplate) run against the green environment before traffic flips, and against production after β€” with automatic rollback.
πŸ” Verified supply chain Sigstore cosign keyless signing in CI + Kyverno verifyImages admission policy. Unsigned or tampered images are rejected at the API server β€” even with valid registry credentials.
πŸ“œ Policy as Code Kyverno enforces image provenance; the framework is in place to extend to Pod Security, resource limits, and registry allow-lists.
πŸ›°οΈ Runtime security Falco (eBPF) detects suspicious syscalls in real time β†’ Falcosidekick β†’ web UI.
πŸ“Š Full-stack observability Prometheus (metrics) + Loki (logs via Grafana Alloy) + Grafana (unified UI) + Alertmanager.
πŸ”‘ Secret hygiene No credential ever lives in git. All secrets are Kubernetes Secrets referenced by name; charts consume them via existingSecret.
🌐 Unified HTTPS ingress Every UI served on 443 through Traefik with path- and host-based routing.

πŸ—οΈ Architecture

flowchart TB
    subgraph dev["πŸ‘¨β€πŸ’» Developer"]
        code["git push"]
    end

    subgraph ci["βš™οΈ CI β€” GitHub Actions (devsecops-pipeline)"]
        scan["Scan gates<br/>ESLint Β· npm audit<br/>Gitleaks Β· SonarCloud"] --> build["Build image"]
        build --> imgscan["Trivy CVE<br/>+ Syft SBOM"] --> push["Push to Docker Hub"]
        push --> sign["cosign keyless sign<br/>+ Rekor transparency log"]
    end

    subgraph git["πŸ“¦ GitOps Repo (this repo β€” source of truth)"]
        root["root-app"] --> apps["11 Argo CD Applications"]
    end

    subgraph cluster["☸️ k3s Cluster"]
        direction TB
        argo["Argo CD<br/>(reconcile loop)"]
        subgraph delivery["Progressive Delivery"]
            rollout["Argo Rollouts<br/>blue-green + smoke tests"]
            kyverno["Kyverno<br/>verifyImages admission"]
        end
        subgraph sec["Security"]
            falco["Falco (eBPF)<br/>runtime detection"]
        end
        subgraph obs["Observability"]
            prom["Prometheus"]
            loki["Loki + Alloy"]
            graf["Grafana"]
        end
        app["cowsay app<br/>(blue / green)"]
    end

    code --> build
    push -.image.-> app
    code --> git
    git --> argo
    argo --> delivery & sec & obs
    kyverno -->|verify signature| app
    rollout -->|promote| app
    falco -.watches.-> app
    obs -.observe.-> app

    classDef green fill:#2f7e3f,stroke:#1b5e20,color:#fff
    classDef blue fill:#1b98e0,stroke:#0d47a1,color:#fff
    class sign,kyverno,falco green
    class argo,rollout blue
Loading

🧰 Technology Stack

Layer Tools
Infrastructure GCP Compute Engine Β· k3s (lightweight Kubernetes)
GitOps / CD Argo CD (app-of-apps) Β· Argo Rollouts (blue-green)
CI Security Scanning ESLint (SAST) Β· npm audit (SCA) Β· Gitleaks (secrets) Β· SonarCloud (code quality/SAST) Β· Trivy (image CVEs) Β· Syft (SBOM)
CI / Supply Chain GitHub Actions Β· Sigstore cosign (keyless OIDC) Β· Rekor transparency log Β· Docker Hub
Policy & Admission Kyverno β€” verifyImages, ClusterPolicy
Runtime Security Falco (modern eBPF) Β· Falcosidekick + UI
Metrics Prometheus Β· Alertmanager Β· kube-state-metrics Β· node-exporter
Logs Loki Β· Grafana Alloy (log collector)
Dashboards Grafana (Prometheus + Loki + Alertmanager datasources)
Ingress / TLS Traefik (path + host routing on 443)
Packaging Helm Β· Kustomize (base + overlays)

βš™οΈ CI Pipeline β€” shift-left security gates

The application source lives in a separate repo (devsecops-pipeline) whose GitHub Actions workflow enforces security before an image is ever published. Every push to main runs a fail-fast gauntlet β€” if any gate fails, no image is built, pushed, or signed. Pull requests run the same scans (build + test) but skip publish/sign, so untrusted code can never produce a signed artifact.

flowchart LR
    A["ESLint<br/><sub>SAST Β· lint</sub>"] --> B["npm audit<br/><sub>SCA Β· deps</sub>"]
    B --> C["Gitleaks<br/><sub>secret scan</sub>"]
    C --> D["SonarCloud<br/><sub>code quality</sub>"]
    D --> E["Docker Build<br/><sub>sha + latest</sub>"]
    E --> F["Trivy<br/><sub>CVE scan</sub>"]
    F --> G["Syft<br/><sub>SBOM</sub>"]
    G --> H["Docker Hub<br/><sub>push</sub>"]
    H --> I["Cosign<br/><sub>keyless sign</sub>"]

    classDef gate fill:#b3261e,stroke:#7f1d1d,color:#fff
    classDef build fill:#1b98e0,stroke:#0d47a1,color:#fff
    classDef publish fill:#2f7e3f,stroke:#1b5e20,color:#fff
    class A,B,C,D,F gate
    class E,G build
    class H,I publish
Loading
# Stage Category What it does / why it's a gate
1 ESLint (--max-warnings=0) SAST / lint Fails on any lint warning β€” code style and correctness enforced with zero tolerance.
2 npm audit (--audit-level=high) SCA Fails the build on high/critical vulnerabilities in dependencies.
3 Gitleaks Secret scanning Scans the full history for leaked credentials, tokens, and keys.
4 SonarCloud SAST / quality Deep static analysis β€” bugs, code smells, security hotspots, coverage.
5 Docker Build Packaging Builds and tags the image with the immutable git SHA and latest.
6 Trivy (exit-code: 1, CRITICAL,HIGH) Image scanning Fails the build if the built image contains critical/high CVEs.
7 Syft SBOM Generates an SPDX SBOM of the image, uploaded as a build artifact.
8 Docker Hub push (push only) Publish Pushes sha + latest tags β€” reached only after every gate is green.
9 Cosign sign (push only) Supply chain Keyless signs both tags via GitHub OIDC β†’ the signature Kyverno verifies at admission (next section).

Least-privilege permissions: the workflow requests only contents: read, security-events: write, actions: read, and id-token: write (the last enables keyless OIDC signing β€” no long-lived signing key exists).

This CI job produces the signature that the platform verifies at deploy time β€” the two halves meet at the Kyverno admission gate below. πŸ‘‡


πŸ” Supply-Chain Security β€” the trust chain

This is the heart of the "Sec" in DevSecOps. It uses keyless signing β€” there is no private key to steal; trust is rooted in identity.

sequenceDiagram
    participant CI as GitHub Actions (CI)
    participant Fulcio as Sigstore Fulcio (CA)
    participant Rekor as Rekor (transparency log)
    participant Reg as Docker Hub
    participant K8s as Kubernetes API
    participant Kyverno as Kyverno Webhook

    CI->>Fulcio: OIDC token "I am CI.yml @ main"
    Fulcio-->>CI: short-lived signing certificate (~10 min)
    CI->>Reg: push image + signature
    CI->>Rekor: record signature (public, immutable)
    Note over K8s,Kyverno: later, at deploy time
    K8s->>Kyverno: admission review (new Pod)
    Kyverno->>Reg: fetch signature
    Kyverno->>Rekor: verify inclusion
    Kyverno-->>K8s: βœ… issuer + subject match β†’ admit<br/>❌ otherwise β†’ REJECT
Loading

Kyverno policy (Enforce mode) requires every Pod to carry a cosign signature proving it was built by exactly the GitHub Actions workflow CI.yml on main of the pipeline repo, verified against the Rekor transparency log β€” then rewrites the tag to an immutable digest (mutateDigest) so what was verified is what runs. An attacker with stolen registry credentials still cannot run a tampered image.


πŸš€ Zero-Downtime Blue-Green Delivery

The application is an Argo Rollouts Rollout with a fully automated blue-green strategy.

flowchart LR
    A["New image<br/>synced by Argo CD"] --> B["🟒 Green ReplicaSet<br/>starts (users still on πŸ”΅ Blue)"]
    B --> C{"Pre-promotion<br/>smoke tests<br/>(preview URL)"}
    C -- "❌ fail" --> X["Abort β€” users never affected"]
    C -- "βœ… pass" --> D["⚑ Traffic flips to Green<br/>(instant, zero downtime)"]
    D --> E{"Post-promotion<br/>smoke tests<br/>(live URL)"}
    E -- "❌ fail" --> R["βͺ Auto-rollback to Blue<br/>(kept warm 30s)"]
    E -- "βœ… pass" --> F["🟒 Green becomes new Blue"]
Loading
  • No human in the loop β€” from image push to production cutover is fully automated.
  • The gate is real β€” a broken build fails its smoke tests on the preview environment and never reaches users.
  • Verified zero-downtime β€” a probe fired continuously at cowsay.danindu.site during a real cutover recorded 75/75 successful requests.
  • Live and preview β€” production traffic serves the active (blue) version at cowsay.danindu.site; the next (green) version is exercised on a separate preview host before it is ever promoted.
# Watch a release happen live
kubectl argo rollouts get rollout devsecops -n devsecops --watch

πŸ“Š Observability

A complete metrics-and-logs stack, all reconciled by GitOps:

  • Prometheus scrapes the cluster and workloads (bounded retention for a lean footprint).
  • Grafana Alloy ships every pod's logs to Loki.
  • Grafana ships pre-wired with Prometheus, Loki, and Alertmanager datasources β€” metrics and logs in one pane.
  • Falco streams runtime security events to the Falcosidekick UI (e.g. "Terminal shell in a container" the instant someone execs into a pod).

πŸ—‚οΈ Repository Structure

.
β”œβ”€β”€ argocd/
β”‚   β”œβ”€β”€ root-app.yaml                 # the ONE Application applied by hand β€” bootstraps everything
β”‚   └── apps/                         # app-of-apps: what Argo CD manages
β”‚       β”œβ”€β”€ devsecops-app.yaml        #   β†’ the application workload
β”‚       └── platform-apps.yaml        #   β†’ the platform (multi-source)
β”‚
β”œβ”€β”€ apps/devsecops/                   # the application (Kustomize)
β”‚   β”œβ”€β”€ base/
β”‚   β”‚   β”œβ”€β”€ rollout.yaml              # Argo Rollouts blue-green Rollout
β”‚   β”‚   β”œβ”€β”€ analysis-template.yaml    # automated smoke tests (release gate)
β”‚   β”‚   β”œβ”€β”€ service.yaml              # active (blue) service
β”‚   β”‚   └── service-preview.yaml      # preview (green) service
β”‚   └── overlays/prod/                # environment-specific image pin
β”‚
└── platform/                         # the platform components
    β”œβ”€β”€ kyverno/                      # policy engine (Helm)
    β”œβ”€β”€ kyverno-policy/               # cosign image-verification ClusterPolicy
    β”œβ”€β”€ observability/                # kube-prometheus-stack Β· Loki Β· Alloy (Helm + values)
    β”œβ”€β”€ falco/                        # runtime security (Helm, eBPF)
    β”œβ”€β”€ argo-rollouts/               # progressive delivery controller (Helm)
    └── ingress/                      # Traefik routing for every service

⚑ How It Works (GitOps reconciliation)

  1. Bootstrap once: kubectl apply -f argocd/root-app.yaml.
  2. The root Application watches argocd/apps/ and creates every child Application.
  3. Each child Application deploys its slice of the platform β€” from Helm registries or from this repo.
  4. Everything self-heals: manual cluster changes are automatically reverted to match git. Merging to main is deploying.
# One command reconstructs the entire platform on a fresh cluster:
kubectl apply -f argocd/root-app.yaml

πŸ”’ Security & Secrets Posture

  • Zero secrets in git. Every credential is a Kubernetes Secret referenced by name (existingSecret); the manifests contain only references.
  • Admission-time enforcement via Kyverno β€” bad images can't even be scheduled.
  • Runtime detection via Falco eBPF β€” suspicious behavior is surfaced live.
  • TLS everywhere β€” all UIs are served over HTTPS through Traefik.
  • Least privilege β€” the workload runs as non-root, read-only root filesystem, all Linux capabilities dropped.

🧠 Engineering Decisions Worth Noting

  • Modern eBPF for Falco instead of kernel modules β€” no kernel-header build step, works on managed cloud kernels.
  • Grafana Alloy over Promtail β€” Promtail is end-of-life; Alloy is the supported successor.
  • Multi-source Argo CD Applications β€” Helm charts from upstream registries combined with values files from this repo via $values refs, keeping upstream charts pristine.
  • Server-Side Apply for large CRDs β€” avoids the client-side annotation size limit that breaks big policy CRDs.
  • Blue-green over rolling update β€” enables a real, testable pre-production environment and instant rollback.

βœ… Implemented

  • Pure GitOps β€” app-of-apps, self-healing, auto-prune
  • CI security gates β€” ESLint, npm audit, Gitleaks, SonarCloud, Trivy, Syft SBOM
  • Keyless image signing (cosign) + admission-time verification (Kyverno)
  • Immutable git-SHA image tags produced in CI
  • Zero-downtime blue-green with automated smoke-test gates and rollback
  • Runtime security (Falco eBPF) and full-stack observability (Prometheus/Loki/Grafana)
  • Zero secrets in git β€” all credentials as referenced Kubernetes Secrets

Built with a GitOps-first, security-by-default philosophy.

Declarative Β· Auditable Β· Self-healing Β· Zero-downtime

About

Production-grade DevSecOps GitOps platform featuring secure CI/CD, automated GitOps, zero-downtime deployments, policy-as-code, supply chain security, runtime protection, and full observability with Argo CD, Kyverno, Falco, Prometheus, Grafana, Loki, Cosign, and GitHub Actions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages