How to Troubleshoot the Ingress for Your Kubernetes Cluster

Issues with your Kubernetes cluster? If Pods and Service are fine, the problem might be the Ingress. Follow this guide for step-by-step troubleshooting.

Patrick Londa
Author
Oct 7, 2022
 • 
 min read
Share this post

First, you should ensure that your Pods are ready and running. If you’re still at that stage, you can use some of our other guides on running a global health check on your Pods, or solving specific issues like Pods stuck in a pending state, or errors like CrashLoopBackOff, ImagePullBackOff, and RunContainerError.

Next, you should check that your Service is routing traffic to Pods. You can use this troubleshooting guide for your Service.

If you have completed those checks and you’re still having issues, then it is likely that the Ingress is misconfigured.

In this guide, we’ll walk you through the common steps of troubleshooting the Ingress configuration.

blink logo
kubernetes logo
Blink Automation: Troubleshoot Your Kubernetes Ingress
Blink + Kubernetes
Get Started

Ingress Troubleshooting Steps

So, your Pods are Running and Ready, and your Service configuration is routing traffic correctly. Next, the Ingress should connect traffic to your Service and Pods correctly.

Before getting into the weeds, the first thing to check is that the values listed for service.name and service.port in your Ingress configuration are correct.

To inspect the Ingress configuration for “demo-ingress”, you can use the following command:

kubectl describe ingress demo-ingress

You’ll see an output that looks like this:

Name:             demo-ingress
Namespace:        default
Rules:  
  Host        Path  Backends
  ----        ----  --------  
  *              /   demo-service:80 (<error: endpoints "demo-service" not found>)

If the "Backends" column is empty, you have an error in the configuration.

If there are endpoints in the "Backends" column but you still cannot access your application, you should check how you exposed your ingress and cluster to the public internet.

To identify if it's an issue with your infrastructure or your Ingress controller, you should try connecting the Ingress to the Pod directly.

To do so, you need to isolate infrastructure issues from ingress by connecting directly to the Pod with the Ingress controller. This learnK8s guide has a useful example of how to do that:

  1. Recall your Ingress controller Pod:
kubectl get pods --all-namespaces
NAMESPACE   NAME                              READY STATUS
kube-system coredns-5644d7b6d9-jn7cq          1/1   Running
kube-system etcd-minikube                     1/1   Running
kube-system kube-apiserver-minikube           1/1   Running
kube-system kube-controller-manager-minikube  1/1   Running
kube-system kube-proxy-zvf2h                  1/1   Running
kube-system kube-scheduler-minikube           1/1   Running
kube-system nginx-ingress-controller-6fc5bcc  1/1   Running
  1. Retrieve the port by describing the Pod:
kubectl describe pod nginx-ingress-controller-6fc5bcc

--namespace kube-system \
 | grep Ports
    Ports:         80/TCP, 443/TCP, 8443/TCP
    Host Ports:    80/TCP, 443/TCP, 0/TCP
  1. Connect to the Pod with this command:
kubectl port-forward nginx-ingress-controller-6fc5bcc 3000:80 --namespace kube-system
Forwarding from 127.0.0.1:3000 -> 80
Forwarding from [::1]:3000 -> 80

Now, when you visit port 3000 on your computer, the request is forwarded to port 80 on the Pod. If the application works now, the issue is related to your infrastructure and you need to look into how traffic is routed to your cluster.

If your application still doesn’t work, then you should debug your Ingress controller.

There are multiple types of Ingress controllers that teams use, and troubleshooting steps vary for each. You can review debugging instructions for your specific controller.

Debugging guides:

Troubleshooting Your Ingress with Blink

Troubleshooting Kubernetes issues is often a process of elimination where you collect information and cross out likely reasons. This can take a lot of time and research, depending on your issue.

There’s an easier and faster way to manage your Kubernetes troubleshooting.

With Blink, you can use no-code steps to readily pull all the key information and events to help you solve your issue. We have pre-built automations ready to help you work through common Pod, Service, and Ingress issues.

Get started with Blink and jumpstart your Kubernetes troubleshooting today.

Expert Tip