Skip to content

Implement Environment Variable Kubeconfig Support #148

Closed
@spo0nman

Description

@spo0nman

The mcp-server-kubernetes currently loads kubeconfig from either an in-cluster service account or the default ~/.kube/config file. This limits its usability in environments where file creation is restricted or impractical, such as serverless platforms, containers, and CI/CD pipelines.

This issue proposes adding support for configuring Kubernetes access via environment variables to enable file-less deployment scenarios.

Implement environment variable support for kubeconfig in mcp-server-kubernetes, maintaining backward compatibility with existing methods.


🛠️ Proposed Changes

Modify the KubernetesManager constructor in frontend/vendor/mcp-server-kubernetes/src/utils/kubernetes-manager.ts to load kubeconfig information in the following priority:

  1. In-cluster service account (existing)
  2. KUBECONFIG_DATA: Full kubeconfig as a YAML string.
  3. KUBECONFIG_JSON: Full kubeconfig as a JSON string.
  4. K8S_SERVER + K8S_TOKEN: Minimal configuration with individual variables (K8S_SKIP_TLS_VERIFY optional).
  5. Default file (~/.kube/config) (existing fallback)

Benefits

  • Enables deployment in serverless and containerized environments.
  • Facilitates CI/CD pipeline integration.
  • Allows for easier integration with secret management systems.
  • Avoids the need for temporary file creation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions