Pass --kubeconfig to all kubectl subprocess invocations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 99
- Forks
- 62
- Avg merge
- 6d 12h
- Merged PRs (30d)
- 17
Description
Description
Currently, kubectl commands invoked via subprocess do not receive the --kubeconfig flag, causing them to fall back to default kubeconfig resolution ($HOME/.kube/config or KUBECONFIG env var). This creates inconsistency when KubernetesSystem.kube_config_path points to a non-default location: the Kubernetes Python client API uses the configured path (via load_kube_config()), but kubectl subprocesses may target a different cluster.
Affected Code
All kubectl invocations in src/cloudai/systems/kubernetes/kubernetes_system.py:
kubectl exec(line ~313)kubectl get pods(line ~255)kubectl cp(line ~325)kubectl delete dgd(line ~488)
Proposed Solution
Add --kubeconfig flag with the resolved kube_config_path value to all kubectl subprocess commands to ensure consistency with the Python API client configuration.
Example:
kubectl_cmd = ["kubectl", "--kubeconfig", str(self.kube_config_path), "exec", "-n", self.default_namespace, ...]
Context
Identified during review of PR #793: https://github.com/NVIDIA/cloudai/pull/793#discussion_r2745665546
Requested by: @amaslenn
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/cloudai/systems/kubernetes/kubernetes_system.py and inspect the kubectl invocations for exec, get pods, cp, and delete dgd. Verify each subprocess command uses the resolved self.kube_config_path, and consider how existing command construction is covered before confirming all four paths use the same configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes, python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 56/100