⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Kubernetes Interview Questions Scenario 131 of 207 in Kubernetes
Senior DevOps / SRE [L2] Kubernetes Additional Kubernetes Scenarios (Q101-Q200) Production Scenario [L2]
🎯 Target Role / Context: Kubernetes Scenario #121 (L2) · Additional Kubernetes Scenarios (Q101-Q200)

Q: What is the difference between imagePullPolicy Always, IfNotPresent, and Never in Kubernetes? How does Kubernetes decide the default policy, and what are the performance and security implications in production?

Detailed comparison of Kubernetes imagePullPolicy options (Always, IfNotPresent, Never), default evaluation rules, container image caching, network egress optimization, and security risks with mutable tags.

#imagepullpolicy always vs ifnotpresent #imagePullPolicy #IfNotPresent vs Always #imagePullPolicy Never #Kubernetes image caching #latest tag antipattern #Kubernetes #L2 #SRE #Comparisons
🎙️ Candidate Opening & Architectural Context
""In our production Kubernetes clusters running microservices on EKS/AKS, this was a classic operational challenge. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix.""
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's CKA & CKAD Hands-On Certification Track covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: "In our production Kubernetes clusters running microservices on EKS/AKS, this was a classic operational challenge. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix."

1️⃣

Core Behavior of Each Policy

How kubelet handles image pulls when starting a container:

  • Always: Every time the kubelet starts a container, it contacts the remote image registry to resolve the digest. If the remote image has changed, it downloads the new layers. If unchanged, it uses the cached layers. If registry auth fails or registry is down, pod startup fails immediately.
  • IfNotPresent: Kubelet checks if the image exists in the local node cache. If present, it starts the container immediately without contacting the remote registry. Only downloads if the image is missing from the node.
  • Never: Kubelet never attempts to contact the registry. Assumes the image was pre-loaded onto the node host; fails with ErrImageNeverPull if missing.
2️⃣

How Kubernetes Chooses the Default When Omitted

Kubernetes automatically assigns imagePullPolicy based on the image tag format:

  • If the image tag is :latest (or if no tag is specified), Kubernetes automatically defaults to Always.
  • If the image tag is a specific version tag (e.g. :v1.2.3 or SHA256 digest), Kubernetes defaults to IfNotPresent.
Advertisement
3️⃣

Performance vs Security Best Practices

Key considerations in enterprise clusters:

  • Cold Start Latency: IfNotPresent provides 10x faster pod autoscaling (HPA) during traffic surges because nodes reuse cached layers without network roundtrips.
  • Registry Rate Limits & Outages: Always subjects every pod restart to external registry availability and rate limits (e.g. Docker Hub 429).
  • Security Best Practice: Never use :latest with IfNotPresent. Always deploy immutable semantic tags or SHA256 digests (app@sha256:...) combined with IfNotPresent to guarantee reproducible, fast, and tamper-proof deployments.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"In production, use immutable semantic version tags or sha256 digests with imagePullPolicy: IfNotPresent to achieve lightning-fast node autoscaling while preventing unpredictable tag mutation drift."
⚡ 60-Second Elevator Pitch Talking Points
  • Configured immutable image tags with imagePullPolicy: IfNotPresent across all production Helm charts.
  • Eliminated registry rate limit failures and slashed pod scheduling startup latency during HPA scale-out events.
  • Enforced Kyverno admission policies forbidding mutable :latest tags and imagePullPolicy: Never.
  • Guaranteed reproducible zero-drift container execution across multi-node Kubernetes clusters.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Over-granting cluster-admin permissions to pod ServiceAccounts instead of scoping namespace Roles when configuring Kubernetes imagePullPolicy Always Over-granting cluster-wide permissions violates least-privilege principles and allows compromised pods to escalate privileges across namespaces.
  2. Referencing mutable latest container tags across production Kubernetes Deployment specs when configuring Kubernetes imagePullPolicy Always Deployments referencing :latest risk inconsistent versions across replica pods and break deterministic rollback capabilities.
  3. Omitting pod readiness probes, causing traffic to hit uninitialized application containers when configuring Kubernetes imagePullPolicy Always Readiness probes gate traffic delivery; missing probes cause Kubernetes to route user requests to pods before dependencies or caches are loaded.
  4. Executing diagnostic triage without analyzing chronological cluster events and describe outputs when configuring Kubernetes imagePullPolicy Always Cluster events provide sequential timestamps of scheduler decisions, probe failures, and image pull timeouts essential for rapid root-cause isolation.
Advertisement
📥 FREE DOWNLOAD · 101-PAGE COMPANION HANDBOOK
Studying for Kubernetes & SRE Technical Rounds?
Download the complete 100-question PDF field guide covering all 11 core modules with offline diagnostic runbooks.
📥 Download PDF (Free) Read Online Guide →
Want more Kubernetes scenarios?
Explore our complete collection of scenario-based Kubernetes interview runbooks.
Browse All Kubernetes Questions →