HashiCorp Vault + External Secrets Operator: Zero-Trust Secrets Management
TL;DR Secrets in Git, classic Kubernetes secrets, and manual processes are no longer sufficient for …
Diese Serie erklärt systematisch, wie moderne Software compliant entwickelt und betrieben wird – von EU-Regulierungen bis zur technischen Umsetzung.
For modern, regulation-compliant software delivery, a clean CI/CD pipeline is not “nice to have” but the technical organizational chart of your organization. In many companies, GitLab assumes this role – in the ayedo platform, it is the first step in the end-to-end workflow.
An application repository should already reflect the later automation:
src/ for a Django app).gitlab-ci.yml that maps the entire lifecycle of the applicationThe exact folder structure is less important than the clear separation of responsibilities: code, infrastructure definition, and delivery logic remain distinguishable. This facilitates audits and reduces the risk of “hidden” configurations.
A typical pipeline for a Django application can be divided into four main stages:
This separation creates transparency: An auditor or a new team lead can immediately see where tests take place, when images become immutable, and where security checks apply.
Furthermore, approval processes can be implemented along these stages: for example, only on the main branch do full pipelines run up to and including package and deploy, while feature branches are limited to test and possibly build. This way, you combine developer productivity with clear control points.
The days when a privileged Docker daemon ran in the CI runner should be over – not only for security reasons but also because many compliance frameworks critically view the operation of privileged services in shared environments.
Both Kaniko and Buildah are designed to build container images without a running Docker daemon and without root rights in the container:
Kaniko
Buildah
Both approaches significantly reduce the attack surface of your runners. This is particularly relevant if you want to meet the requirements of NIS2 in the future (effective from 18.10.2024), where secure operating processes and risk minimization are explicitly required.
A secure image does not start with the scanner but in the Dockerfile. For a Django application, the following principles have proven effective:
These patterns are not a matter of style but significantly ease security assessments: fewer packages mean fewer potential CVEs, and clear version specifications make it easier to respond to advisories and scans.
Another building block towards a regulation-compliant supply chain is the Software Bill of Materials (SBOM). It describes which components (e.g., Python packages, system libraries) are contained in an image.
In the pipeline, the SBOM step should be closely linked to the container build:
This creates a foundation to respond to future regulatory requirements – for example, when customers or regulatory authorities request detailed information on your software’s component list under the Cyber Resilience Act.
A modern registry like Harbor is much more than a place where latest tags are “parked”. In a well-designed CI/CD landscape, Harbor becomes the security and compliance gateway between build and deployment.
In the build stage of the pipeline, the image is created with Kaniko or Buildah and then pushed into a dedicated project in Harbor. Typically, at least one immutable tag (e.g., commit hash or build number) and optionally a “movable” tag like latest are created.
This push is a clear handover point: Before, the image is a temporary result of a build; afterward, it is a versioned artifact that may be used by production systems – but only after it has passed the defined controls in Harbor.
Harbor integrates vulnerability scanners and automatically performs image scanning after each push. For a Django app based on a Python or Debian/Ubuntu base image, both OS packages and runtime libraries are captured.
The key strength lies in the policies:
This builds a bridge between the security team and delivery teams: Not every finding immediately blocks the pipeline, but nothing goes through silently.
In addition to scanning, image signing is gaining significant importance. Harbor supports modern signature mechanisms (e.g., Notary v2, cosign) and can enforce signatures as a prerequisite for certain actions.
A practical model:
This creates a cryptographically secured chain: Only images that actually originate from your GitLab pipeline reach the production clusters. This is a central building block to effectively prevent supply chain attacks such as the introduction of foreign images.
Even though this first part of the series ends with the push to Harbor, the topic of secrets already belongs in this section – otherwise, credentials unnecessarily end up in GitLab variables or even in repositories.
HashiCorp Vault serves as the central hub in the ayedo platform for:
Instead of storing fixed username/password pairs in GitLab, the pipeline retrieves short-lived tokens or dynamic credentials from Vault. This significantly reduces the risk of leaked secrets while simultaneously meeting common requirements for least privilege and rotation.
The External Secrets Operator is the link between Vault and your /kubernetes/ cluster. It automatically synchronizes secrets from Vault into native Kubernetes secrets, which can then be used by deployments.
Even though the actual rollout in this article series is only covered in the second part with ArgoCD, you should already ensure:
This creates a supply chain where artifacts (images, charts) and configuration (secrets) are clearly separated but technically well-integrated.
What does this look like concretely – but without YAML – for a Django app?
In the test stage, typically:
It is important that this stage runs on all relevant branches and remains fast enough not to slow down developer feedback.
The build stage takes over:
At the end of this stage, there is a clearly identifiable, signed, and SBOM-equipped image in Harbor – the foundation for any further use.
TL;DR Secrets in Git, classic Kubernetes secrets, and manual processes are no longer sufficient for …
TL;DR A modern container registry is now a central compliance tool, especially in the context of the …
TL;DR Traditional container builds with Docker Daemon, root privileges, and docker.sock in CI …