skip to content

Pull vs Push Delivery

Whether the cluster pulls its own config or CI pushes it with cluster credentials. Interviewers use this to test security reasoning: the pull model exists mainly so a compromised CI runner does not hold kubeconfigs for every environment.

on this pageshow

questions

5

In GitOps, what is the difference between push-based and pull-based delivery to a Kubernetes cluster, and where does the cluster credential live in each model?

level: juniorimportance: must knowfreq 68%

answer

  1. who opens the connection
  2. direction of travel matters
  3. where the kubeconfig is stored
  4. agent inside the cluster, ServiceAccount
  5. credential never leaves the cluster

basics

~20 s

Push delivery means the CI job holds a kubeconfig and runs kubectl or helm against the cluster. Pull delivery means an agent inside the cluster reads manifests from Git and applies them itself, so no outside system holds cluster credentials.

solid answer

~50 s

Both models start from the same commit; what differs is who opens the connection. In **push** delivery the pipeline is the actor: a CI job authenticates to the cluster's API server — usually with a kubeconfig or a cloud identity stored in the CI secret store — and runs `kubectl apply` or `helm upgrade`. In **pull** delivery an agent installed in the cluster (Argo CD and Flux are the usual choices) reads the desired state from a Git repository or an OCI artifact and applies it to its own API server, using an in-cluster ServiceAccount. So under push the cluster credential lives outside the cluster, in the CI system, once per environment; under pull it never leaves the cluster, and what CI needs instead is write access to a repository and a registry. That credential placement is the main reason teams adopt the pull model.

code

bash · 6 lines
bash
# Push model: CI holds cluster credentials and acts on the cluster
set -euo pipefail
echo "$KUBECONFIG_CONTENT" > "$HOME/.kube/config"
chmod 600 "$HOME/.kube/config"
kubectl set image deployment/web web=registry.example.com/web:1.4.2
kubectl rollout status deployment/web --timeout=120s

go deeper

for a junior

Be able to say plainly which side starts the connection: in push, CI runs kubectl or helm against the cluster; in pull, an agent inside the cluster reads Git and applies it. Name where the kubeconfig lives in each.

for a middle

Explain the mechanics: the agent authenticates with an in-cluster ServiceAccount, CI needs only repository and registry write access, and push requires the API server to be reachable from the runner. Mention that short-lived credentials narrow but do not change the push model.

for a senior

Show you know what moved rather than disappeared — Git merge rights become deploy rights, and the agent itself is a privileged component that needs scoping. Note that the pipeline loses synchronous deploy feedback once it stops calling the cluster.

for a principal

Own the tradeoff at fleet scale: how many environments, whose credential blast radius you are shrinking, who operates and upgrades the agents, and whether the audit story is better in Git history or in pipeline logs.

## Two directions of travel "Delivery" here means getting a change from a repository into a running Kubernetes cluster. Both models begin with the same thing: a commit that describes the desired state — a Deployment manifest, a chart's values, a kustomization. What separates them is which side initiates the connection. In **push-based** delivery the CI/CD pipeline is the actor. A job in the pipeline authenticates to the cluster's API server and issues imperative commands against it: `kubectl apply -f`, `kubectl set image`, `helm upgrade --install`, or a vendor CLI wrapping the same calls. The pipeline decides when the deploy happens, watches it, and reports success or failure in the same job. In **pull-based** delivery a piece of software running inside the cluster is the actor. It watches a Git repository (or an OCI artifact holding the same manifests), notices that the declared state differs from what is running, and applies the difference to its own cluster's API server. The pipeline's last deployment-related act is a commit; nothing in CI ever talks to the cluster. ## Where the credential sits This is the part interviewers are actually testing. Under push, something outside the cluster must be able to authenticate as a highly privileged principal to the Kubernetes API — a kubeconfig with a client certificate or token, or a cloud IAM identity mapped to cluster roles. That credential is stored in the CI system, injected into a job that also executes build scripts and third-party dependencies, and it exists once per environment. A team with dev, staging and production has three sets of cluster credentials concentrated in one system. ```bash # Push model: the CI job authenticates to the cluster itself echo "$KUBECONFIG_CONTENT" > "$HOME/.kube/config" kubectl set image deployment/web web=registry.example.com/web:1.4.2 kubectl rollout status deployment/web --timeout=120s ``` Under pull, the credential the agent uses is an in-cluster ServiceAccount bound to roles in that same cluster. It is created at install time and never leaves the cluster boundary — there is nothing to copy into CI, nothing to rotate across systems, and no single external account that can reach every environment. What CI needs instead is write access to the configuration repository and push access to an image registry. ```bash # Pull model: CI's last deployment act is a commit sed -i 's|tag: .*|tag: "1.4.2"|' env/prod/values.yaml git commit -am "prod: web 1.4.2" && git push # an in-cluster agent notices the change and applies it ``` Using short-lived federated credentials instead of a static kubeconfig narrows the push model's exposure, but it does not change the shape: a system outside the cluster is still able to obtain API access, and it is still reachable by whatever runs in that pipeline. ## Direction of network connections The second structural difference follows from the first. Push requires the API server to be reachable from wherever the runner executes — a hosted runner on the public internet, a runner placed inside the VPC, or a VPN/private-link path. Pull requires only outbound connections from the cluster to the Git host and the registry, both ordinary HTTPS or SSH egress. For clusters with no inbound exposure at all, that difference decides the design. ## What the pull model does not change A weak answer treats pull as "the secure one" and stops. It relocates trust rather than removing it: - **Git becomes the control surface.** Anyone who can merge to the watched branch can change production. Review, branch protection and commit signing now carry the weight the cluster credential used to. - **The agent is privileged.** It typically holds broad apply rights inside its cluster, so it is itself a target and should be scoped to the namespaces or tenants it owns. - **Images still come from a registry.** A poisoned image referenced by a legitimate tag is applied just as faithfully. - **Someone still needs cluster access for humans** — debugging, logs, incident response — so the API server does not become unreachable to everyone. ## Saying it in an interview Name the actor and the credential in one breath: push means CI reaches into the cluster with a kubeconfig it stores; pull means the cluster reaches out to Git with credentials that never leave it. Then say what that buys — a smaller and better-scoped blast radius when the CI system is compromised — and what it costs, which is that your pipeline no longer learns synchronously whether the deploy worked.

  • If the pipeline uses short-lived OIDC-federated credentials rather than a stored kubeconfig, is push delivery then equivalent to pull?
    No. Short-lived credentials shrink the window and remove a long-lived secret at rest, which is a genuine improvement, but the shape is unchanged: a system outside the cluster can still obtain API access, and anything that can run in that pipeline can request it. Pull's claim is structural — no external system is authorised to call the API server at all.
  • In the pull model, who is allowed to deploy to production?
    Whoever can get a commit onto the branch or path the agent watches. Deployment authority moves from "who holds the credential" to "who can merge", so branch protection, required review, and restricting which repository paths the agent trusts become the actual access controls.
  • Does adopting a pull-based agent mean nobody needs kubectl access any more?
    No. Humans still need read access for debugging, log retrieval and incident response, and someone must be able to reach the cluster when the agent itself is broken. What goes away is the automated, always-on write credential held by an external system, not human access.

Push is handing the courier a key to your house so they can put the parcel inside. Pull is the household checking the mailbox on its own schedule — the courier never needs a key.

saying these in an interview costs you the question

  • Calling pull "the secure model" without saying which credential moved
  • Thinking the agent authenticates using CI's kubeconfig
  • Assuming pull-based delivery removes the need for any cluster access
  • Believing the commit or manifests differ between the two models
  • Claiming push is fine because the kubeconfig is "in a secret store"

context

open as a page

A CI runner that deploys to all your Kubernetes environments is compromised. What does the attacker gain under push-based delivery, and what does moving to pull-based delivery not protect you from?

level: seniorimportance: must knowfreq 58%

basics

~20 s

Under push, the runner holds cluster credentials for every environment, so the attacker gets immediate admin-level access to all of them. Pull removes that credential, but not a poisoned image or a malicious commit, which the in-cluster agent will apply faithfully.

open as a page

Your team keeps its existing CI pipeline but adopts an in-cluster GitOps agent for Kubernetes deploys. Which responsibilities move to the agent, and what does the CI pipeline lose?

level: middleimportance: should knowfreq 55%

basics

~20 s

Applying manifests and keeping the cluster converged move to the agent; CI keeps building, testing, scanning, publishing the artifact and recording the desired state. The pipeline loses synchronous deploy feedback — its job finishes before the change is actually running.

open as a page

You lead platform engineering at a company shipping to Kubernetes clusters, VM fleets and managed serverless. Would you mandate pull-based GitOps delivery everywhere, and how would you decide?

level: principalimportance: should knowfreq 40%

basics

~20 s

No. Pull-based delivery needs a reconciling agent for the target's API, which is mature for Kubernetes and rare elsewhere. Mandate it for cluster workloads and keep push with short-lived, narrowly scoped credentials for VMs and serverless.

open as a page

A production Kubernetes cluster accepts no inbound connections from outside its network. How does pull-based delivery work there, and what do you give up compared with a cluster your CI system can reach?

level: seniorimportance: nice to knowfreq 36%

basics

~20 s

The in-cluster agent makes outbound connections only — to the Git host and the image registry — so no inbound path to the API server is needed at all. You give up synchronous deploy feedback and inbound webhooks, so syncs fall back to interval polling and status must be pushed outward.

open as a page