🔄

CI pipeline failed at deploy step

Build passed but deploy to K8s/registry failed — common fixes across CI platforms.

Reviewed: ·Tested on: Kubernetes 1.29, Terraform 1.8, Ubuntu 22.04

Symptoms

  • Docker push denied or unauthorized
  • kubectl: Unable to connect or forbidden
  • Pipeline succeeds on build but fails on deploy stage

1Identify which stage failed

Open the failed job log. Separate build, test, push, and deploy — each has different fixes.

2Registry auth (push denied)

docker login registry.example.com -u $CI_USER -p $CI_TOKEN
# verify secret in CI variables / K8s imagePullSecret

3Cluster access from CI

kubectl config get-contexts
kubectl auth can-i create deployments --namespace=<ns>
# store KUBECONFIG or use cloud OIDC in CI

4Re-run with debug

Enable verbose logging, pin image tags (avoid :latest), and test deploy script locally with same env vars.

kubectl apply -f k8s/ --dry-run=server
helm upgrade --install app ./chart --debug --dry-run

Related