Troubleshoot a Website That Is Not Accessible
Scenario
A web application showcasing the Solo Leveling anime universe — characters, dungeons, and the world of hunters — has been deployed in the solo-leveling namespace, but the website is not accessible.
Investigate why the website is not accessible and fix the issue so that the Solo Leveling universe explorer is reachable at:
curl http://cplane-01:30333
⏳ Wait a few seconds for the environment to fully set up. It may take up to 1 minute.
Hint 1 — Check Why the Service Has No Endpoints
Start by checking whether the Service has any endpoints — endpoints are the pod IPs that the Service routes traffic to. If there are no endpoints, traffic can never reach the pods.
kubectl get endpoints solo-leveling-service -n solo-leveling
kubectl describe endpoints solo-leveling-service -n solo-leveling
If endpoints are empty, the Service selector does not match any pod labels. Compare the Service selector with the actual pod labels:
kubectl get svc solo-leveling-service -n solo-leveling -o yaml | grep -A5 selector
kubectl get pods -n solo-leveling --show-labels
Documentation
Hint 2 — Check What Port the Application Is Listening On
Even after fixing the selector, the Service may still fail if the targetPort
does not match the port the container is actually listening on. Check the nginx
configuration to find the real port:
kubectl get configmap nginx-config -n solo-leveling \
-o jsonpath='{.data.nginx\.conf}'
Then check what the Service targetPort and Deployment containerPort are
set to, and update them to match.
Documentation