Skip to content

KDM show runner is not wokring #12

@utkarsh232005

Description

@utkarsh232005

Bug: kdm show runners crashes with EHOSTUNREACH when Kubernetes API is unreachable

Description

Running the following command:

kdm show runners

causes the CLI to crash when the Kubernetes API server is unreachable.

Instead of handling the connection failure gracefully, the application throws an uncaught exception and exits.


Error Output

utkarsh-patrikar@utkarsh:~$ kdm show runners

📦 Fetching runners (Containers + Pods)...
🚨 Triggering alert for container:minikube:failure: Docker container minikube (5314126ab747) exited with code 137.

❌ Failed to fetch Kubernetes pods: connect EHOSTUNREACH 192.168.49.2:8443

node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error: connect EHOSTUNREACH 192.168.49.2:8443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1705:16) {
  errno: -113,
  code: 'EHOSTUNREACH',
  syscall: 'connect',
  address: '192.168.49.2',
  port: 8443
}

Node.js v24.15.0

Expected Behavior

The CLI should:

  • Catch Kubernetes connection failures gracefully
  • Display a user-friendly warning/error message
  • Continue showing available Docker container information if possible
  • Avoid crashing the entire process

Example:

⚠ Unable to connect to Kubernetes cluster (192.168.49.2:8443)
✔ Showing Docker runner status only

Actual Behavior

  • Application throws an unhandled promise rejection
  • CLI exits unexpectedly
  • Docker runner information flow is interrupted

Possible Cause

The Kubernetes client request is not wrapped in proper try/catch handling or promise rejection handling.

When the Minikube cluster is stopped or unreachable, the connection attempt to:

192.168.49.2:8443

fails with:

EHOSTUNREACH

and crashes the process.


Suggested Fix

  • Add proper error handling around Kubernetes API calls
  • Handle network-related errors like:
    • EHOSTUNREACH
    • ECONNREFUSED
    • ETIMEDOUT
  • Prevent uncaught promise rejections
  • Fallback to Docker-only mode when Kubernetes is unavailable

Example:

try {
  await fetchPods();
} catch (err) {
  console.error("⚠ Unable to connect to Kubernetes cluster");
}

Environment

  • OS: Ubuntu Linux
  • Node.js: v24.15.0
  • Kubernetes: Minikube
  • Command: kdm show runners

Impact

This issue prevents the CLI from functioning reliably in environments where Kubernetes is temporarily unavailable or restarting.

Users monitoring Docker containers should still be able to use the tool even if the Kubernetes cluster is down.


Additional Notes

The issue appears after the Minikube container exits or the Kubernetes API becomes unreachable.

The CLI should remain stable even if Kubernetes is temporarily unavailable.
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions