Closed
Description
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:
- In-cluster service account (existing)
KUBECONFIG_DATA
: Full kubeconfig as a YAML string.KUBECONFIG_JSON
: Full kubeconfig as a JSON string.K8S_SERVER
+K8S_TOKEN
: Minimal configuration with individual variables (K8S_SKIP_TLS_VERIFY
optional).- 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.