Skip to main content

EKS Debugging Guide

19 min read

Baseline environment: EKS 1.32+, kubectl (within ±1 minor of the EKS minor, per the version skew policy), AWS CLI v2

1. Overview​

Issues that occur during EKS operations span multiple layers including the control plane, nodes, network, workloads, storage, and observability. This document is a comprehensive debugging guide for SREs, DevOps engineers, and platform teams to systematically diagnose and quickly resolve these issues.

The commands provide diagnostic and remediation examples. Replace cluster, namespace, resource, and account placeholders for the environment under investigation, and distinguish inspection commands from commands that change resources. Use the decision trees to select the next check from the observed symptom.

EKS Debugging Layers​

Figure 1. EKS debugging layer structure

Expand the diagram to read labels and follow connections.
Diagram

Debugging Approach Methodology​

Two approaches are available for EKS problem diagnosis.

Table 1. Comparison of Top-down and Bottom-up debugging approaches

ApproachDescriptionSuitable Situations
Top-down (symptom → cause)Start from user-reported symptoms and trace back to causesImmediate response to service outages and performance degradation
Bottom-up (infra → app)Check layers sequentially starting from infrastructurePreventive checks, validation after cluster migration
Generally Recommended Order

For production incidents, a Top-down approach is recommended. First identify the symptom (Section 2 Incident Triage), then navigate to the debugging section for that layer.


2. Incident Triage (Rapid Fault Determination)​

First 5 Minutes Checklist​

When an incident occurs, the most important actions are scope determination and initial response.

30 seconds: Initial diagnosis​

# Check cluster status
aws eks describe-cluster --name <cluster-name> --query 'cluster.status' --output text

# Check node status
kubectl get nodes

# Check abnormal Pods
kubectl get pods --all-namespaces | grep -v Running | grep -v Completed
# Note: phase-based filters can miss Running-but-unready Pods (0/1) and CrashLoopBackOff.
# Also inspect the READY column and restart counts.
kubectl get pods --all-namespaces --no-headers | \
awk '$3=="CrashLoopBackOff" || ($3=="Running" && $2 !~ /^([0-9]+)\/\1$/) {print}'

2 minutes: Scope determination​

# Check recent events (all namespaces)
kubectl get events --all-namespaces --sort-by='.lastTimestamp' | tail -20

# Aggregate Pod states for a specific namespace
kubectl get pods -n <namespace> --no-headers | awk '{print $3}' | sort | uniq -c | sort -rn

# Check distribution of abnormal Pods by node
kubectl get pods --all-namespaces -o wide --field-selector=status.phase!=Running | \
awk 'NR>1 {print $8}' | sort | uniq -c | sort -rn

5 minutes: Initial response​

# Detailed information on the problem Pod
kubectl describe pod <pod-name> -n <namespace>

# Previous container logs (for CrashLoopBackOff)
kubectl logs <pod-name> -n <namespace> --previous

# Check resource usage (kubectl top requires Metrics Server, not installed by default on EKS)
# Install: https://github.com/kubernetes-sigs/metrics-server
kubectl top nodes
kubectl top pods -n <namespace> --sort-by=cpu

Scope Determination Decision Tree​

Figure 2. Problem scope determination decision tree

Expand the diagram to read labels and follow connections.
Diagram

AZ Failure Detection​

AWS Health API Requirements

The aws health describe-events API is available on Business, Enterprise On-Ramp, and Enterprise Support plans (Developer plan excluded). Without a Support plan, check directly from the AWS Health Dashboard console or capture Health events via EventBridge rules.

# Check EKS/EC2-related events via AWS Health API (Business/Enterprise On-Ramp/Enterprise Support plan required)
aws health describe-events \
--filter '{"services":["EKS","EC2"],"eventStatusCodes":["open"]}' \
--region us-east-1

# Alternative: AZ failure detection without Support plan — create EventBridge rule
aws events put-rule \
--name "aws-health-eks-events" \
--event-pattern '{
"source": ["aws.health"],
"detail-type": ["AWS Health Event"],
"detail": {
"service": ["EKS", "EC2"],
"eventTypeCategory": ["issue"]
}
}'

# put-rule alone delivers nothing. Attach a target (SNS/Lambda/SQS, etc.) for notification/processing.
aws events put-targets \
--rule "aws-health-eks-events" \
--targets "Id"="1","Arn"="arn:aws:sns:us-east-1:<account-id>:eks-health-notifications"

# Count affected nodes per AZ (sort -u deduplicates node names, so this counts affected nodes, not Pods)
# Note: the phase!=Running filter excludes Running-but-unready Pods.
kubectl get pods --all-namespaces -o json | jq -r '
.items[] |
select(.status.phase != "Running" and .status.phase != "Succeeded") |
select(.spec.nodeName != null) |
.spec.nodeName
' | sort -u | while read node; do
zone=$(kubectl get node "$node" -o jsonpath='{.metadata.labels.topology\.kubernetes\.io/zone}' 2>/dev/null)
[ -n "$zone" ] && echo "$zone"
done | sort | uniq -c | sort -rn

# Check ARC Zonal Shift status
aws arc-zonal-shift list-zonal-shifts \
--resource-identifier arn:aws:eks:region:account:cluster/name

AZ Failure Response Using ARC Zonal Shift​

# Enable Zonal Shift in EKS
aws eks update-cluster-config \
--name <cluster-name> \
--zonal-shift-config enabled=true

# Start manual Zonal Shift (move traffic away from failed AZ)
aws arc-zonal-shift start-zonal-shift \
--resource-identifier arn:aws:eks:region:account:cluster/name \
--away-from us-east-1a \
--expires-in 3h \
--comment "AZ impairment detected"
Zonal Shift Caveats

The maximum duration of a Zonal Shift is 3 days and can be extended. Starting a shift blocks new traffic to Pods running on nodes in that AZ, so first verify that other AZs have sufficient capacity.

Scope of a Zonal Shift

EKS-native ARC Zonal Shift changes Load Balancer / Service-level traffic routing and, at the same time, cordons the nodes in that AZ to block new Pod scheduling and suspends Availability Zone rebalancing for Managed Node Groups. It does not, however, evict running Pods or terminate nodes.

⚡ ARC Zonal Shift impact scope
Zonal Shift blocks traffic and also cordons the nodes in that AZ, blocking new scheduling — check the impact per layer
LayerZonal Shift impactAutomaticManual action
🔀 ALB / NLBRemoved from the Target Group in that AZ✅-
🔀 EKS Service (kube-proxy)Endpoint weight removed for that AZ✅-
💻 Existing nodesKeep running without termination, but nodes in that AZ are cordoned so new Pods are not scheduled✅Move Pods with kubectl drain
📦 Existing PodsRemoved from EndpointSlices so traffic stops, but the Pods themselves are not terminated (not evicted)✅Rescheduled automatically on drain
⚙️ Karpenter NodePoolAZ settings unchanged; new nodes can still be created in that AZ❌Edit NodePool requirements
📊 ASG (Managed Node Group)AZ rebalancing is suspended and the ASG is updated so that new nodes launch only in healthy AZs (EKS removes the impaired AZ from the ASG)✅-
💾 EBS volumesPinned to the AZ, cannot move❌Snapshot → restore in another AZ
📁 EFS Mount TargetNew mounts can use another AZ mount target via the Regional DNS name; existing mounts do not switch automatically❌Remount Pods mounted in that AZ

AZ settings (subnet lists) for Karpenter NodePools and ASGs (Managed Node Groups) are not updated automatically. Therefore, complete AZ evacuation requires the following complementary actions:

  1. Start Zonal Shift → Block new traffic (automatic)
  2. Drain nodes in that AZ → Move existing Pods
  3. Remove the AZ from the Karpenter NodePool or ASG subnets → Prevent new node provisioning
# 1. Identify and drain nodes in the failed AZ
for node in $(kubectl get nodes -l topology.kubernetes.io/zone=us-east-1a -o name); do
kubectl cordon $node
kubectl drain $node --ignore-daemonsets --delete-emptydir-data --grace-period=60
done

# 2. Temporarily exclude the AZ from the Karpenter NodePool (modify requirements)
# Caution: --type=merge replaces the entire requirements array, discarding existing arch/capacity-type and other constraints.
# Read the existing requirements first and re-apply the full set with only the zone constraint changed.
# kubectl get nodepool default -o jsonpath='{.spec.template.spec.requirements}'
kubectl patch nodepool default --type=merge -p '{
"spec": {"template": {"spec": {"requirements": [
{"key": "topology.kubernetes.io/zone", "operator": "In", "values": ["us-east-1b", "us-east-1c"]}
]}}}
}'

# 3. Managed Node Groups require ASG subnet changes (perform via console or IaC)

After the Zonal Shift is lifted, the above changes must be reverted.

CloudWatch Anomaly Detection​

# 1. put-anomaly-detector only creates the anomaly detection model (band), not an alarm.
# pod_number_of_container_restarts requires the PodName dimension, so include it.
aws cloudwatch put-anomaly-detector \
--single-metric-anomaly-detector '{
"Namespace": "ContainerInsights",
"MetricName": "pod_number_of_container_restarts",
"Dimensions": [
{"Name": "ClusterName", "Value": "<cluster-name>"},
{"Name": "Namespace", "Value": "production"},
{"Name": "PodName", "Value": "<pod-name>"}
],
"Stat": "Average"
}'

# 2. Create the actual alarm with put-metric-alarm referencing the ANOMALY_DETECTION_BAND.
aws cloudwatch put-metric-alarm \
--alarm-name "pod-restarts-anomaly" \
--comparison-operator GreaterThanUpperThreshold \
--evaluation-periods 1 \
--threshold-metric-id ad1 \
--metrics '[
{"Id":"m1","MetricStat":{"Metric":{"Namespace":"ContainerInsights","MetricName":"pod_number_of_container_restarts","Dimensions":[{"Name":"ClusterName","Value":"<cluster-name>"},{"Name":"Namespace","Value":"production"},{"Name":"PodName","Value":"<pod-name>"}]},"Period":300,"Stat":"Average"},"ReturnData":true},
{"Id":"ad1","Expression":"ANOMALY_DETECTION_BAND(m1, 2)","ReturnData":true}
]'

Incident Response Escalation Matrix​

🚨 Incident response escalation matrix
Initial response time and escalation path by severity
🔴P1 - Critical⏱ within 5 minutes
Escalation: on-call immediately + managerControl plane outage, all nodes NotReady
🟠P2 - High⏱ within 15 minutes
Escalation: on-call teamSingle-AZ failure, many Pods in CrashLoopBackOff
🟡P3 - Medium⏱ within 1 hour
Escalation: owning teamHPA scaling failure, intermittent timeouts
🔵P4 - Low⏱ within 4 hours
Escalation: backlogSingle Pod restart, non-production issue
See High-Availability Architecture Guide

For architecture-level fault recovery strategies (TopologySpreadConstraints, PodDisruptionBudget, multi-AZ deployment, etc.), see the EKS Resiliency Guide.


10. Debugging Quick Reference​

Error Pattern → Cause → Resolution Quick Reference Table​

🔍 Error pattern quick reference
Error pattern → cause → resolution quick reference (18 entries)
1CrashLoopBackOff
App crash, misconfiguration, unmet dependency
→ kubectl logs --previous, check app configuration/environment variables
2ImagePullBackOff
Image does not exist, registry authentication failure
→ Check image name/tag, configure imagePullSecrets
3OOMKilled
OOM from exceeding the container limit, or eviction under node memory pressure (MemoryPressure)
→ If the limit was exceeded, raise the memory limit/check for leaks; if the node was under pressure, check node conditions and node capacity against requests
4Pending (unschedulable)
Insufficient resources, nodeSelector mismatch
→ Check kubectl describe pod events, check node capacity/labels
5CreateContainerConfigError
ConfigMap/Secret does not exist
→ Confirm the referenced ConfigMap/Secret exists
6Node NotReady
kubelet failure, resource pressure
→ Connect to the node with SSM, systemctl status kubelet
7FailedAttachVolume
The EBS volume is attached to another node (node failure, multi-attach, VolumeAttachment not released, etc.)
→ Identify the node holding the volume, clean up the previous Pod/VolumeAttachment, wait for detach to complete (if not released, force-detach after about 6 minutes)
8FailedMount
EFS mount target/SG misconfiguration
→ Confirm the mount target exists and TCP 2049 is allowed
9NetworkNotReady
VPC CNI not started
→ kubectl logs -n kube-system -l k8s-app=aws-node
10DNS resolution failed
CoreDNS failure
→ Check CoreDNS Pod status/logs, kubectl rollout restart
11401 Unauthorized / 403 Forbidden
401 = authentication failure (token/identity mapping), 403 = authorization failure (insufficient RBAC permissions). aws-auth/Access Entry affects identity mapping
→ For 401, check aws sts get-caller-identity and the aws-auth/Access Entry mapping; for 403, check RBAC Role/Binding
12connection refused
No Service Endpoint, port mismatch
→ kubectl get endpoints, check selector and ports
13Evicted
Node resource pressure (DiskPressure, etc.)
→ Clean up node disk, adjust Pod resource requests
14FailedScheduling: Insufficient cpu/memory
Insufficient cluster capacity
→ Raise Karpenter NodePool limits, add nodes
15Terminating (stuck)
Finalizer not completed, preStop hook delay
→ Investigate the finalizer/process first. --force --grace-period=0 only removes the API object and does not guarantee process termination or finalizer cleanup (last resort)
16Back-off pulling image
Wrong image name/tag, registry authentication failure (imagePullSecrets/ECR permissions), pull timeout for a large image
→ Check image name/tag and registry authentication, optimize the image, use a same-Region registry such as ECR
17readiness probe failed
Slow app startup, health check endpoint error
→ Add a startupProbe, adjust the probe timeout
18Too many pods
Maximum Pods per node exceeded
→ Check the max-pods setting, enable Prefix Delegation

Essential kubectl Command Cheat Sheet​

Query and diagnosis​

# See all resource status at a glance
kubectl get all -n <namespace>

# Filter only abnormal Pods
kubectl get pods --all-namespaces --field-selector=status.phase!=Running,status.phase!=Succeeded

# Pod details (including events)
kubectl describe pod <pod-name> -n <namespace>

# Namespace events (sorted newest first)
kubectl get events -n <namespace> --sort-by='.lastTimestamp'

# Resource usage
kubectl top nodes
kubectl top pods -n <namespace> --sort-by=memory

Log inspection​

# Current container logs
kubectl logs <pod-name> -n <namespace>

# Previous (crashed) container logs
kubectl logs <pod-name> -n <namespace> --previous

# Specific container in a multi-container Pod
kubectl logs <pod-name> -n <namespace> -c <container-name>

# Real-time log streaming
kubectl logs -f <pod-name> -n <namespace>

# Logs from multiple Pods by label
kubectl logs -l app=<app-name> -n <namespace> --tail=50

Debugging​

# Debug with an ephemeral container
kubectl debug <pod-name> -it --image=nicolaka/netshoot --target=<container-name>

# Node debugging
kubectl debug node/<node-name> -it --image=ubuntu

# Execute a command inside a Pod
kubectl exec -it <pod-name> -n <namespace> -- <command>

Deployment management​

# Rollout status/history/rollback
kubectl rollout status deployment/<name>
kubectl rollout history deployment/<name>
kubectl rollout undo deployment/<name>

# Restart a Deployment
kubectl rollout restart deployment/<name>

# Node maintenance (drain)
kubectl cordon <node-name>
kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
kubectl uncordon <node-name>

Table 2. Recommended debugging tools by scenario

ScenarioToolDescription
Network debuggingnetshootContainer bundled with networking tools
Node resource visualizationeks-node-viewerTerminal-based node resource monitoring
Container runtime debuggingcrictlcontainerd debugging CLI
Log analysisCloudWatch Logs InsightsAWS-native log query
Metric queriesPrometheus / GrafanaPromQL-based metric analysis
Distributed tracingADOT / OpenTelemetryRequest path tracing
Cluster security scanningkube-benchCIS Benchmark-based security scan
YAML manifest validationkubeconform (recommended) / kubeval (no longer maintained)Pre-deployment manifest validation
Karpenter debuggingKarpenter controller logsDiagnose node provisioning issues
IAM debuggingAWS IAM Policy SimulatorValidate IAM permissions

EKS Log Collector​

EKS Log Collector is a script provided by AWS that automatically collects logs needed for debugging from EKS worker nodes and generates an archive file that can be shared with AWS Support.

Installation and execution:

# Download and run the script (after SSM connecting to the node)
curl -O https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-log-collector.sh
sudo bash eks-log-collector.sh

Collected items:

  • kubelet logs
  • containerd logs
  • iptables rules
  • CNI config (VPC CNI configuration)
  • cloud-init logs
  • dmesg (kernel messages)
  • systemd unit status

Output:

Collected logs are saved in a compressed archive following the format /var/log/eks_i-xxxx_yyyy-mm-dd_HH-MM-SS.tar.gz.

S3 upload:

# The script has no upload option. Upload the generated archive with aws s3 cp.
aws s3 cp /var/log/eks_*.tar.gz s3://my-bucket/
Leveraging AWS Support

Attaching this log file when submitting an AWS Support case enables support engineers to quickly understand node state, significantly reducing time to resolution. Always attach it when reporting node join failures, kubelet failures, or network issues.


Detailed Debugging Guides​

Use the following links to view detailed debugging guides for each layer:

Table 3. Detailed debugging guide documents by layer

DocumentDescriptionKey Topics
Control Plane DebuggingDiagnose EKS control plane issuesAPI Server logs, AuthN/AuthZ, Add-ons, IRSA, Pod Identity, RBAC
Node DebuggingDiagnose node-level issuesNode join failures, kubelet/containerd, resource pressure, Karpenter, Managed Node Group
Workload DebuggingDiagnose Pod and workload issuesPod state-based debugging, Deployment, HPA/VPA, Probe configuration
Networking DebuggingDiagnose network issuesVPC CNI, DNS, Service, NetworkPolicy, Ingress/LoadBalancer
Storage DebuggingDiagnose storage issuesEBS CSI, EFS CSI, PV/PVC status, volume mount failures
ObservabilityMonitoring and log analysisContainer Insights, Prometheus, CloudWatch Logs Insights, ADOT

References​