Appearance

Debug network and storage failures

Use a small set of comparisons to locate a failed network hop or a failed storage stage.

What you will understand

  • Compare DNS resolution, Service traffic, and direct endpoint reachability from the same caller.
  • Distinguish an unbound claim from a mounting or application permissions failure.
  • Verify a repair by repeating the original request or file operation.

Builds on: Debug the failing workload

Compare direct and Service connections

An API becomes unreachable after a change. First reproduce the symptom from a client with the same network and policy as the one that fails. Write down the name it looked up, the address it used, the port, and the result. Keep as much of that test fixed as possible while you change one part of the path.

The Service selects backends and gives clients a stable address. EndpointSlices show the selected addresses, ports, and conditions. A client can get a DNS answer even when there are no ready endpoints. Compare a failing request through the Service with a request to a known ready Pod’s IP and target port. If the direct request works from the same caller, you can focus on Service mapping and forwarding. If both fail, inspect the backend listener, policy, or network route. Use the scene to reason from each pair of results.

Which network test rules out which cause?

Compare DNS resolution, Service connectivity, and a direct request to a ready Pod from the same caller.

  1. Resolve the Service name

    Resolve the Service name from the same client and inspect resolver configuration if this fails.

  2. Inspect eligible endpoints

    Inspect selector labels and readiness conditions. A Service with no usable backend can still resolve successfully.

  3. Try the Service address

    Send to ClusterIP and Service port. This tests virtual-address forwarding plus the remaining backend path.

  4. Compare the direct backend address

    Bypass DNS and Service selection using the ready Pod address and target port from the same client. A difference narrows the failing boundary.

One healthy-looking backend; actual provider may transform packet addresses at different points.

Inspect YAML or commands

Test resolution

kubectl exec client -- nslookup api
Explore another case

Test DNS and the backend from the client

Run the commands with an existing api Service, matched Pods, and client. The full DNS name assumes namespace learning and domain cluster.local. Substitute the actual namespace and domain if different. Read search domains inside the client. If the fully qualified name resolves but the short name does not, investigate which namespace the client searches. Where NetworkPolicy applies, check both the caller’s egress and the destination’s ingress, including DNS access.

kubectl get service api -o yaml
kubectl get pods -l app=api -o wide
kubectl get endpointslices -l kubernetes.io/service-name=api -o yaml
kubectl exec client -- nslookup api.learning.svc.cluster.local
kubectl exec client -- cat /etc/resolv.conf
kubectl exec client -- wget -T 3 -qO- http://api:80
# Substitute a ready endpoint address and its actual target port.
kubectl exec client -- wget -T 3 -qO- http://POD_IP:8080

Find where storage setup or access failed

Now consider a writer that cannot create a file in /data. Follow its claim before checking the filesystem. An unbound PVC can mean the class does not exist, no PV fits, provisioning failed, or the class is waiting for a consumer. A bound claim with a pending Pod can point to placement, attachment, or mount trouble. Check the Pod events to see which operation the kubelet or controller reports. CSI drivers that use a distinct attachment step can also publish VolumeAttachment objects.

kubectl get pod writer -o wide
kubectl describe pod writer
kubectl get pvc
kubectl describe pvc app-data
kubectl get pv
kubectl get storageclass
kubectl get volumeattachments

Find the first failed storage stage

A healthy PVC can still be followed by attachment, mount, or file access errors. Check each stage separately.

  1. Check the PVC and PV

    A Pending claim needs class, provisioner and consumer-topology evidence. A Bound claim has passed that checkpoint.

  2. Check attach state

    An attachment error can reflect topology or another active node attachment. Establish writer ownership before forcing detach.

  3. Check whether the mount exists

    FailedMount points to a later checkpoint such as backend connectivity, mount options, credentials or filesystem setup.

  4. Check process and file permissions

    A running container with permission denied may have a healthy mount but incompatible UID, group, mode or read-only settings.

A CSI driver with attachment is illustrated; some drivers skip that checkpoint.

Inspect YAML or commands

Check application permission

kubectl exec writer -- id
Explore another case

If the Pod runs and the mount exists, inspect the actual mount path, the process UID and group, file ownership, and whether the mount is read-only. A healthy claim can be completely unrelated to a permission error in the container. Practice an evidence-led repair in the debugging lab, or reproduce the storage checks with the writer from the persistent storage lesson.

Retest the failing operation after repair

Keep the working state available for comparison. Deleting a claim to test a mount error can release the underlying data. A port-forward can reach a backend while sidestepping the client path you need to diagnose. Retest using the original client or process and verify the precise operation that failed.

Check your understanding

The writer runs, the claim is Bound, and reading works, but writes return a permission error. Where should you look first?

Check mount flags and file ownership for the user running the process. These symptoms indicate the app reached mounted data. They give you a better starting point than replacing the volume or modifying the StorageClass.

Primary documentation

Go to the source

Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise

Search the book

Search loads when you open it.

Keyboard shortcuts

Ctrl + K / ⌘ + K
Search the book
?
Open this guide
Tab / Shift + Tab
Move between controls
Enter / Space
Activate a focused button or disclosure
← / →
Focused visual timeline · previous or next step
Home / End
Focused visual timeline · first or last point
Esc
Close the open dialog or menu