The Simplest Way to Make Buildkite and Kustomize Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use buildkite and kustomize together to build and ship Kubernetes apps. Buildkite runs the pipeline steps, while Kustomize patches YAML files for each stage. This pair keeps your base manifests clean and free of duplicate text. Your agents build container images, update image tags, and apply the output to clusters. When set up well, teams ship code fast with clear logs for every run. How buildkite and kustomize pass data and keys A pipeline run starts when a developer pushes code to a

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use buildkite and kustomize together to build and ship Kubernetes apps. Buildkite runs the pipeline steps, while Kustomize patches YAML files for each stage.

This pair keeps your base manifests clean and free of duplicate text. Your agents build container images, update image tags, and apply the output to clusters. When set up well, teams ship code fast with clear logs for every run.

How buildkite and kustomize pass data and keys

A pipeline run starts when a developer pushes code to a Git branch. The Buildkite cloud control plane sees the commit and wakes up a local agent. That agent pulls the repo, which holds your base YAML files and overlays. Kustomize reads those folders to merge patches without changing the original base files.

During the build step, the agent compiles the app and pushes a new image. Next, the pipeline passes the new image digest into the Kustomize build step. Kustomize writes the new tag into the rendered manifest output on the agent disk. Up to this point, the agent only needs read and write keys for images.

The deploy step needs real cluster keys to apply the rendered YAML files. The agent uses an identity role to log in to the target Kubernetes cluster. It sends the final manifest stream to the cluster API server over the network. The cluster checks the role rules and creates or updates the running pods.

Common risks with shared agent roles and broad keys

Many teams run all pipeline steps on one pool of shared build agents. If those agents hold cluster admin keys, any build script can read those keys. A pull request from a test branch could change production workloads by mistake. Broad service accounts also make it hard to see which person triggered a change.

Long-lived static tokens stored in pipeline variables create another big security risk. If a build log prints those secrets, anyone reading the log can copy them. Shared tokens also lack clear audit trails in the Kubernetes cluster event logs. Every action looks like it came from the same generic build bot account.

End-to-End Encryption + Kustomize Security Overlays: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Another failure happens when Kustomize pulls remote bases from outside Git repos during builds. If a remote repo changes without warning, your pipeline might apply bad cluster rules. Teams should vendor remote bases or pin them to exact commit hashes in Git.

Scoping agent roles and network paths

Split your agents into separate queues for building code and applying cluster changes. Build agents only need keys to pull source code and push container images. Deploy agents run on locked-down hosts and only accept jobs from protected branches. This split stops untrusted test code from reaching your production cluster network.

Give each deploy queue a narrow Kubernetes role tied to one namespace only. A staging agent should never hold a role that can write to production namespaces. Use short-lived workload tokens from your cloud provider instead of static cluster keys. Rotate these keys often and expire them as soon as the deploy job ends.

Save the rendered Kustomize YAML output as a build artifact before applying it. A human reviewer can read the exact diff in a manual block step. Once approved, the deploy step pulls that exact file and sends it to Kubernetes. This rule ensures the cluster runs the exact state your team checked.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should Kustomize run during the build step or the deploy step?

Run Kustomize before the deploy step and save the output as a build artifact. This lets your team check the exact YAML file before sending it to clusters.

How do we stop feature branches from deploying to production clusters?

Put deploy agents in a separate queue that only runs jobs for your main branch. Give those specific agents the role needed to write to production namespaces.

How should we handle secrets inside Kustomize overlays?

Do not commit raw secrets into Git overlays for Kustomize to read. Pull secret values from a secret store at deploy time or use encrypted secret controllers.

The query runs. The emails stay hidden.