0
0
Kubernetesdevops~30 mins

Debugging service connectivity in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Debugging service connectivity
📖 Scenario: You are managing a Kubernetes cluster where a simple web service is deployed. The service is supposed to be reachable from inside the cluster, but users report it is not responding. You need to check the service configuration and connectivity step-by-step to find the issue.
🎯 Goal: Learn how to check Kubernetes service and pod connectivity using basic kubectl commands and simple network tests inside the cluster.
📋 What You'll Learn
Use kubectl commands to inspect pods and services
Check pod status and service endpoints
Test connectivity using kubectl exec and curl
Understand basic troubleshooting steps for Kubernetes service connectivity
💡 Why This Matters
🌍 Real World
Kubernetes services are the main way to expose applications inside a cluster. Troubleshooting connectivity issues is a common real-world task to keep apps running smoothly.
💼 Career
DevOps engineers and site reliability engineers often debug service connectivity problems to ensure applications are reachable and healthy.
Progress0 / 4 steps
1
Check the pods in the default namespace
Run the command kubectl get pods -n default to list all pods in the default namespace and check their status.
Kubernetes
Need a hint?

This command lists all pods in the default namespace with their status. Look for pods that are not Running.

2
Check the service details for web-service
Run the command kubectl get service web-service -n default to see the service details including its cluster IP and ports.
Kubernetes
Need a hint?

This command shows the IP and ports the service listens on inside the cluster.

3
Check the endpoints for web-service
Run the command kubectl get endpoints web-service -n default to verify which pod IPs the service routes to.
Kubernetes
Need a hint?

Endpoints show the actual pod IPs behind the service. If empty, the service has no pods to route to.

4
Test connectivity to web-service from a pod
Run the command kubectl exec -n default -it web-pod -- curl -sS http://web-service:80 to test if the service is reachable from inside the cluster. Replace web-pod with the name of a running pod in the default namespace.
Kubernetes
Need a hint?

This command runs curl inside a pod to check if the service responds on port 80.