A Kubernetes Deployment can appear healthy even when some of its Pods are failing to start. The application may continue serving requests through existing Pods while newly created Pods remain stuck in Pending, ImagePullBackOff, CrashLoopBackOff, or another failure state.
This situation commonly occurs during rolling updates.
Consider an application running three replicas. A developer deploys a new container image, and Kubernetes starts replacing the existing Pods. Two new Pods become Ready, but the third repeatedly fails because of an incorrect configuration or missing dependency.
The Deployment cannot complete its rollout. Existing Pods may continue serving traffic, but the application is running with a mixture of old and new versions.
The challenge is to identify why only some Pods are failing, protect the available application instances, and recover the Deployment without introducing another outage.
Kubernetes provides several tools for investigating these problems, including kubectl describe, container logs, events, rollout status, readiness probes, and rollout history.
Understanding how these mechanisms work makes it easier to recover a partially available Deployment.
Understand What Happens During a Rolling Deployment
A Kubernetes Deployment manages ReplicaSets, which are responsible for maintaining the desired number of Pods.
When a Deployment is updated, Kubernetes creates a new ReplicaSet and gradually replaces Pods belonging to the previous ReplicaSet.
For example, suppose an application currently has three replicas:
Current Deployment
ReplicaSet: v1
|
+---- Pod 1 (Running)
+---- Pod 2 (Running)
+---- Pod 3 (Running)
The development team deploys version 2.
Kubernetes creates another ReplicaSet and begins the rollout:
Rolling Update
ReplicaSet: v1
|
+---- Pod 1 (Running)
+---- Pod 2 (Running)
+---- Pod 3 (Running)
ReplicaSet: v2
|
+---- Pod 4 (Starting)
+---- Pod 5 (Starting)
As the new Pods become available, Kubernetes gradually reduces the number of old Pods.
However, suppose Pod 5 starts successfully while Pod 4 encounters an image pull error.
The rollout may now look like this:
Deployment
|
+---- ReplicaSet v1
| |
| +---- Pod 1 (Running)
| +---- Pod 2 (Running)
|
+---- ReplicaSet v2
|
+---- Pod 3 (Running)
+---- Pod 4 (ImagePullBackOff)
The application still has some available replicas, but the new Deployment cannot reach its desired state.
This is an important distinction: a Deployment can remain partially available while its rollout is unsuccessful.
Start by Checking the Deployment Status
The first step is to understand the current state of the Deployment.
Run:
kubectl get deployments
Example output:
NAME READY UP-TO-DATE AVAILABLE AGE
order-api 2/3 1 2 15m
The columns provide useful information:
- READY indicates how many replicas are ready compared with the desired count.
- UP-TO-DATE indicates how many replicas have been updated to the latest Pod template.
- AVAILABLE indicates how many replicas are available to serve traffic.
- AGE indicates how long the Deployment has existed.
In this example, the Deployment expects three replicas, but only two are ready and available.
Next, inspect the Deployment:
kubectl describe deployment order-api
Pay particular attention to the Conditions and Events sections.
A Deployment may report conditions such as:
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing False ProgressDeadlineExceeded
This indicates that the Deployment has not made sufficient progress within its configured progress deadline.
The default progress deadline is 600 seconds.
A ProgressDeadlineExceeded condition does not mean Kubernetes automatically rolls back the Deployment. It reports that progress has stalled, leaving the team to investigate and decide whether to fix or roll back the change.
The Deployment status provides the first indication of a problem, but the actual cause is usually visible at the Pod level.
Identify Which Pods Are Failing
The next step is to inspect the Pods managed by the Deployment.
Run:
kubectl get pods -l app=order-api -o wide
The label selector assumes the Deployment uses app=order-api.
Example output:
NAME READY STATUS RESTARTS AGE
order-api-v2-7f8d9c-abc12 1/1 Running 0 4m
order-api-v2-7f8d9c-def34 0/1 ImagePullBackOff 0 4m
order-api-v1-6b7c8d-ghi56 1/1 Running 0 20m
This output shows that one new Pod is running, another cannot pull its image, and an older Pod is still serving requests.
The STATUS column is particularly important.
Different Pod states point toward different failure categories.
| Pod status | Possible cause |
|---|
| Pending | Scheduling, resource, storage, or admission problem |
| ImagePullBackOff | Image unavailable, incorrect image reference, or registry authentication problem |
| ErrImagePull | Initial image pull failure |
| CrashLoopBackOff | Container repeatedly exits or fails to start |
| ContainerCreating | Container setup, volume mounting, or networking is incomplete |
| Running but not Ready | Readiness probe failure or application initialization problem |
| CreateContainerConfigError | Invalid environment variable, Secret, ConfigMap, or container configuration |
Do not assume that every failed Pod requires the same recovery action.
The correct solution depends on the actual Pod state and its events.
Investigate Pod Events Before Changing the Deployment
Kubernetes events often provide the fastest way to identify why a Pod cannot start.
Run:
kubectl describe pod order-api-v2-7f8d9c-def34
Replace the Pod name with the failing Pod in your cluster.
The output contains several sections, including:
- Pod metadata.
- Node assignment.
- Container specifications.
- Container states.
- Restart counts.
- Conditions.
- Events.
For example, an image pull failure might produce an event similar to:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulling 2m kubelet Pulling image
Warning Failed 2m kubelet Failed to pull image
Warning BackOff 1m kubelet Back-off pulling image
This indicates that the container runtime cannot retrieve the requested image.
Another Pod might show:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 2m default-scheduler Insufficient cpu
This indicates a scheduling problem rather than an application startup failure.
The distinction matters because changing the application configuration will not resolve a node resource shortage.
Events are particularly useful during troubleshooting, but they are not permanent application logs. Kubernetes retains events for a limited period, depending on cluster configuration.
Capture relevant information when investigating intermittent failures.
Recover From ImagePullBackOff
ImagePullBackOff occurs when Kubernetes cannot pull the container image and progressively delays subsequent attempts.
Common reasons include:
- Incorrect image name.
- Invalid image tag.
- Image not pushed to the registry.
- Missing imagePullSecrets.
- Registry authentication failure.
- Insufficient permissions to access a private registry.
First, inspect the container image:
kubectl get deployment order-api \
-o jsonpath='{.spec.template.spec.containers[*].image}'
Verify that the image and tag exist in the registry.
If the registry is private, inspect the Pod's image pull configuration:
kubectl get pod order-api-v2-7f8d9c-def34 \
-o yaml
Look for imagePullSecrets and verify that the referenced Secret exists in the same namespace.
You can also inspect the Secret metadata:
kubectl get secrets
Do not print or expose Secret data while troubleshooting.
If the image reference is incorrect, update the Deployment:
kubectl set image deployment/order-api \
order-api=registry.example.com/order-api:v2.1.1
Here, order-api after the Deployment name is the container name.
Monitor the rollout:
kubectl rollout status deployment/order-api
If the problem was caused by an invalid image reference, the corrected image should allow Kubernetes to create the new Pods.
Avoid repeatedly deleting failed Pods without fixing the image or registry configuration. The Deployment controller will simply create replacement Pods with the same incorrect configuration.
Recover From CrashLoopBackOff
CrashLoopBackOff means a container repeatedly starts, exits, and is restarted according to its restart policy.
The underlying problem may be inside the application.
For example:
- Missing environment variables.
- Invalid configuration files.
- Database connection failures during startup.
- Application exceptions.
- Incorrect entry point.
- File permission problems.
- Insufficient memory.
Start by checking the current container logs:
kubectl logs order-api-v2-7f8d9c-abc12
If the container has restarted, inspect its previous instance:
kubectl logs order-api-v2-7f8d9c-abc12 \
--previous
The --previous option is particularly useful because the current container may have started again after the failure.
For a multi-container Pod, specify the container:
kubectl logs order-api-v2-7f8d9c-abc12 \
-c order-api \
--previous
Suppose the logs show:
Unhandled exception:
System.InvalidOperationException:
Connection string was not configured.
This points toward an application configuration problem.
Inspect the Deployment's environment variables and configuration references:
kubectl describe deployment order-api
If the application reads its connection string from a Kubernetes Secret, verify that the Secret exists and that the correct key is referenced.
For example:
env:
- name: ConnectionStrings__DefaultConnection
valueFrom:
secretKeyRef:
name: order-api-secrets
key: database-connection
The Secret must exist in the same namespace as the Pod, and the specified key must be present.
Fix the underlying configuration rather than increasing the restart delay or repeatedly deleting Pods.
Investigate Pods That Remain Pending
A Pending Pod has not reached the stage where its application container is running.
This usually indicates a scheduling or initialization problem.
Common causes include:
- Insufficient CPU or memory.
- Namespace resource quotas.
- Node selectors that do not match available nodes.
- Untolerated node taints.
- Persistent volume claims that cannot be bound.
- Admission policy restrictions.
Inspect the Pod:
kubectl describe pod order-api-v2-7f8d9c-abc12
A resource-related scheduling failure may look like:
Warning FailedScheduling
0/3 nodes are available:
3 Insufficient memory.
This means the scheduler cannot find a node that satisfies the Pod's resource requests.
Review the Deployment's resource configuration:
resources:
requests:
cpu: "500m"
memory: "512Mi"
limits:
cpu: "1"
memory: "1Gi"
Requests determine the resources Kubernetes uses when scheduling the Pod.
Limits define the maximum resources available to the container.
If requests are too high for the available nodes, the Pod may remain Pending even when some node capacity appears unused.
Review node capacity and existing workloads:
kubectl get nodes
kubectl describe nodes
kubectl top nodes
The kubectl top commands require Metrics Server or another compatible metrics provider.
Possible solutions include adjusting resource requests based on actual application requirements, increasing available node capacity, correcting scheduling constraints, or resolving storage configuration issues.
Do not reduce memory or CPU requests blindly. Underestimating resource requirements can cause performance problems after the Pod starts.
Fix Readiness Probe Failures
A container can be Running without being Ready.
This distinction is important during rolling deployments.
A Running container means the container process is executing. A Ready container has passed its readiness checks and can receive traffic through matching Kubernetes Services.
Consider an ASP.NET Core application that needs several seconds to initialize its dependencies.
If the readiness probe checks the application before it finishes initialization, Kubernetes may repeatedly mark the Pod as not Ready.
A suitable probe configuration might look like this:
apiVersion: apps/v1
kind: Deployment
metadata:
name: order-api
spec:
replicas: 3
selector:
matchLabels:
app: order-api
template:
metadata:
labels:
app: order-api
spec:
containers:
- name: order-api
image: registry.example.com/order-api:v2.1.1
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /health/ready
port: 8080
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
livenessProbe:
httpGet:
path: /health/live
port: 8080
periodSeconds: 20
timeoutSeconds: 3
failureThreshold: 3
The application should expose separate endpoints with clearly defined responsibilities.
The readiness endpoint determines whether the application can accept traffic.
The liveness endpoint determines whether the application is functioning well enough to continue running.
For ASP.NET Core, these endpoints can be implemented using the health checks framework.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHealthChecks();
var app = builder.Build();
app.MapHealthChecks("/health/live");
app.MapHealthChecks("/health/ready");
app.Run();
This is a basic example. In a production application, configure the checks according to the actual dependencies and failure behavior.
Do not make the liveness endpoint depend on every external service.
For example, if a database becomes temporarily unavailable, a liveness probe that checks the database may restart every application Pod simultaneously. This can create a cascading failure.
Readiness and liveness probes should answer different questions.
A readiness failure removes the Pod from normal Service traffic while allowing the container to continue running. A liveness failure can cause the container to restart.
Add a Startup Probe for Slow Applications
Some applications need additional time to start.
They may load configuration, initialize caches, perform migrations, or establish connections with required services.
If the liveness probe begins checking too early, Kubernetes may restart the container before initialization completes.
A startup probe provides a separate startup window.
For example:
startupProbe:
httpGet:
path: /health/live
port: 8080
periodSeconds: 10
failureThreshold: 30
readinessProbe:
httpGet:
path: /health/ready
port: 8080
periodSeconds: 10
failureThreshold: 3
livenessProbe:
httpGet:
path: /health/live
port: 8080
periodSeconds: 20
failureThreshold: 3
With these settings, Kubernetes allows approximately five minutes of startup probe failures before restarting the container.
During this startup period, liveness and readiness probes are not executed.
Once the startup probe succeeds, the other probes begin operating normally.
This is useful for applications with genuinely slow initialization.
However, do not use a startup probe to hide an application that never finishes starting. Investigate startup logs and measure the actual initialization time before selecting thresholds.
Protect Available Pods During Rolling Updates
Kubernetes Deployments support rolling update settings that control how many Pods can be unavailable or created above the desired replica count during an update.
Two important settings are:
Consider this configuration:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
maxUnavailable: 0 tells Kubernetes not to intentionally reduce the number of available replicas below the desired count during the rollout.
maxSurge: 1 allows Kubernetes to create one additional Pod above the desired replica count.
For an application with three replicas, Kubernetes can temporarily create a fourth Pod while replacing existing Pods.
This can help preserve availability during deployment.
However, it requires sufficient cluster resources to schedule the additional Pod.
Also, these settings do not guarantee that the application will remain available if existing Pods fail independently or the cluster does not have enough capacity.
Choose rolling update settings according to application availability requirements, resource capacity, and the application's ability to run multiple versions simultaneously.
Set a Progress Deadline to Detect Stalled Deployments
A Deployment can remain stuck for a long time if the new Pods never become available.
Kubernetes provides progressDeadlineSeconds to define how long it waits without sufficient rollout progress before reporting a stalled Deployment.
For example:
spec:
progressDeadlineSeconds: 600
This sets the progress deadline to 600 seconds.
You can inspect the rollout status using:
kubectl rollout status deployment/order-api
If the rollout exceeds its progress deadline, the command returns a nonzero exit code.
This is useful in CI/CD pipelines because it prevents a deployment job from waiting indefinitely for a rollout that cannot complete.
The progress deadline reports the problem; it does not automatically fix the Deployment or roll it back.
A deployment pipeline should treat a stalled rollout as a failure and follow an explicit recovery procedure.
Roll Back When the New Version Cannot Be Recovered Quickly
Sometimes the issue is not an infrastructure problem.
The new application version may contain a bug, incompatible configuration, or an incorrect runtime dependency.
If the existing version is healthy and the new version cannot be repaired quickly, rolling back may be the safest recovery option.
First, inspect the Deployment history:
kubectl rollout history deployment/order-api
To inspect a particular revision:
kubectl rollout history deployment/order-api \
--revision=2
If the previous version is known to be healthy, roll back:
kubectl rollout undo deployment/order-api
Kubernetes restores the Pod template from the previous revision.
Monitor the rollback:
kubectl rollout status deployment/order-api
Then verify the Pods:
kubectl get pods -l app=order-api
A rollback restores the previous Deployment template, but it does not reverse external side effects.
For example, if the new version already performed a database schema migration, reverting the container image does not automatically undo that migration.
Database compatibility should therefore be considered during release planning.
A safer application deployment strategy uses backward-compatible schema changes so that old and new application versions can operate during a rolling update.
A Complete Troubleshooting Workflow
When only some Pods can start, use a consistent sequence rather than immediately deleting Pods or restarting the Deployment.
The following commands provide a practical starting point:
# 1. Check Deployment status
kubectl get deployments
# 2. Inspect Deployment conditions and events
kubectl describe deployment order-api
# 3. Identify failing Pods
kubectl get pods -l app=order-api -o wide
# 4. Inspect the failing Pod
kubectl describe pod <pod-name>
# 5. Read current container logs
kubectl logs <pod-name>
# 6. Read logs from the previous container instance
kubectl logs <pod-name> --previous
# 7. Check recent namespace events
kubectl get events --sort-by=.metadata.creationTimestamp
# 8. Monitor rollout progress
kubectl rollout status deployment/order-api
# 9. Review Deployment history
kubectl rollout history deployment/order-api
The recovery decision should follow the evidence.
If the image cannot be pulled, fix the image or registry permissions.
If the container crashes, investigate application logs and configuration.
If the Pod remains Pending, investigate scheduling, resources, and storage.
If the container is Running but not Ready, review the readiness endpoint and its dependencies.
If the new version cannot be recovered safely, roll back to a known healthy revision.
This approach avoids unnecessary restarts and helps preserve the Pods that are already serving traffic.
Best Practices for Production Deployments
A few practices make partial Pod failures easier to prevent and recover from.
Use readiness probes to prevent traffic from reaching application instances that have not completed initialization.
Use liveness probes only for failures that genuinely require restarting the container.
Configure startup probes for applications that need additional initialization time.
Set realistic CPU and memory requests based on observed application behavior.
Use maxUnavailable and maxSurge to control the rollout's availability and resource requirements.
Set progressDeadlineSeconds so stalled rollouts become visible to deployment automation.
Keep previous container images available so a rollback can use a known working version.
Use backward-compatible database migrations when deploying multiple application versions simultaneously.
Finally, monitor both Deployment-level availability and individual Pod health. A Deployment may still serve traffic while its latest rollout is failing.
Summary
A Kubernetes Deployment can remain partially available when only some of its Pods fail to start. Existing replicas may continue serving traffic, while newly created Pods encounter image pull errors, scheduling failures, application crashes, or readiness probe failures.
The most effective recovery process starts by inspecting the Deployment, identifying failing Pods, reviewing their events, and checking container logs.
Different Pod states require different solutions. ImagePullBackOff needs image or registry troubleshooting, CrashLoopBackOff requires application-level investigation, Pending Pods need scheduling or resource analysis, and readiness failures require health-check or initialization fixes.
Rolling update settings help preserve available replicas, while progress deadlines make stalled deployments easier to detect. If a new version cannot be recovered safely, Kubernetes rollout history and rollback commands provide a straightforward recovery mechanism.
The key is to diagnose the failing Pods before changing the entire Deployment. A controlled recovery protects healthy replicas, reduces unnecessary restarts, and helps restore a consistent application version.
Join the conversation! Your thoughts help the community grow.