A service works in staging but fails in production. How do you debug it?
In one line: Something is different between the two environments, so systematically compare them — version, configuration, secrets, infrastructure, data, traffic and permissions — using the error messages to guide you.
Step 1 — Get the exact error
- Logs, traces and metrics from production: what fails, for which requests, since when?
Step 2 — Confirm you're running the same thing
- Is it the same image/artifact (compare tags and digests)? If production was built separately, that alone could be the cause.
Step 3 — Compare the common differences
- Configuration — environment variables, feature flags, ConfigMaps, Helm values per environment.
- Secrets and credentials — missing or wrong secret, expired certificate, different API keys.
- Permissions — IAM roles/policies, Kubernetes RBAC, database user rights that exist in staging but not in production.
- Network — security groups, NetworkPolicies, firewall rules, DNS records, private endpoints, egress proxies.
- Infrastructure versions — Kubernetes version, database engine version, instance types, OS/base image.
- Data — production has much more data, unusual records or edge cases (nulls, special characters, very large values) not present in test data.
- Scale and traffic — concurrency and load expose race conditions, connection pool limits and timeouts.
- External integrations — production uses real third-party endpoints (payments, email) with different behaviour or rate limits.
Step 4 — Tools to compare
helm get valuesfor both environments;kubectl diff; Terraform plans; comparing Argo CD app manifests.- Config drift detection.
Step 5 — Fix and prevent
- Fix the difference through code/config (not a manual production change).
- Reduce differences: same IaC modules for every environment, "build once, deploy many", configuration validated in the pipeline, production-like data volumes in staging (masked), and load testing.
Example: a service failed in production with "AccessDenied" when writing to S3. Staging used a broad IAM role; production's role was scoped to a different bucket name. Fixing the Terraform variable and adding a post-deploy smoke test that writes a test object prevented a repeat.
Tip for interviews: list the categories (artifact, config, secrets, permissions, network, data, scale) — that structure shows experience.