Skip to content

# Kubernetes: API client and cluster discovery #460

Description

@ArshSSandhu

Parent: #441

Depends on: Kubernetes node type and configuration

Summary

Implement the Kubernetes API client used by Manager and verify that Manager can authenticate with and inspect a configured Kubernetes cluster.

Use the native Kubernetes API through the official Node.js client. Manager should not invoke kubectl.

Scope

Implement KubernetesApi using:

@kubernetes/client-node

Support:

  • Loading kubeconfig from kubeconfigPath
  • Selecting kubeContext
  • Using the configured kubeNamespace
  • Constructing Kubernetes API clients
  • Validating API connectivity
  • Listing Kubernetes cluster nodes
  • Reading Kubernetes node readiness and addresses
  • Handling authentication and connection errors
  • Mocked unit tests

Cluster discovery

Implement nodes() or the equivalent provider method.

Return useful information such as:

  • Kubernetes node name
  • Ready status
  • Internal IP
  • External IP when available

Keep the result compatible with Manager's provider abstraction where practical.

Error handling

Handle at least:

  • kubeconfig not found
  • invalid kubeconfig
  • requested context not found
  • Kubernetes API unreachable
  • unauthorized
  • forbidden
  • TLS errors

Errors must not include secrets from the kubeconfig.

Acceptance criteria

  • @kubernetes/client-node is added as a dependency.
  • Manager can load the configured kubeconfig.
  • Manager can select an optional context.
  • Manager uses the configured namespace.
  • Manager can connect to a Kubernetes API.
  • Manager can list Kubernetes worker nodes.
  • Node readiness is exposed where available.
  • Node IP information is exposed where available.
  • Kubernetes API failures return useful sanitized errors.
  • No kubectl subprocess is used.
  • Unit tests mock Kubernetes API access.
  • Existing providers remain unaffected.

Out of scope

  • Deployment creation
  • Container lifecycle
  • Reconfiguration
  • Services
  • Ingress
  • Persistent storage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions