Kube-probe TCP probe failed: connection refused

The application is not listening on the specified port, or the service is not running.

Understanding Kube-probe

Kube-probe is a diagnostic tool used in Kubernetes to monitor the health of applications running in a cluster. It helps ensure that applications are functioning correctly by checking their readiness and liveness. Kube-probe can perform HTTP, TCP, and command-based checks to determine the state of an application.

Identifying the Symptom: TCP Probe Failed

One common issue encountered with Kube-probe is the error message: TCP probe failed: connection refused. This indicates that the probe was unable to establish a TCP connection to the application on the specified port.

Exploring the Issue

What Does 'Connection Refused' Mean?

The 'connection refused' error typically means that there is no process listening on the specified port, or the application is not running. This can occur if the application has crashed, is not configured correctly, or the port is incorrect.

Potential Causes

  • The application is not running or has crashed.
  • The application is not listening on the specified port.
  • Network policies or firewall rules are blocking the connection.

Steps to Resolve the Issue

Step 1: Verify Application Status

First, check if the application is running. You can use the following command to list all running pods and their statuses:

kubectl get pods

If the application pod is not running, investigate the logs to determine why it failed to start:

kubectl logs <pod-name>

Step 2: Check Port Configuration

Ensure that the application is configured to listen on the correct port. You can check the container's configuration in the deployment YAML file:

kubectl describe pod <pod-name>

Look for the ports section to verify the correct port is exposed.

Step 3: Network Policies and Firewall

Check if any network policies or firewall rules are blocking the connection. You can review network policies using:

kubectl get networkpolicy

Ensure that the policies allow traffic to the specified port.

Step 4: Restart the Application

If the application was not running, try restarting it:

kubectl rollout restart deployment <deployment-name>

Further Reading

For more information on configuring probes in Kubernetes, refer to the official Kubernetes documentation. Additionally, you can explore troubleshooting steps for debugging applications in Kubernetes.

Master

Kube-probe

in Minutes — Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the whitepaper on your email!
Oops! Something went wrong while submitting the form.

Kube-probe

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the whitepaper on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid