Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional kubectl path to kubeconfig #1703

Open
amaddio opened this issue Jan 24, 2025 · 1 comment
Open

Add optional kubectl path to kubeconfig #1703

amaddio opened this issue Jan 24, 2025 · 1 comment
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@amaddio
Copy link

amaddio commented Jan 24, 2025

Problem

When managing different clusters with different kubectl (server) versions (kubelet api) one has to manually switch between the locally kubectl version. There is no prevention by default that one uses an unsupported kubectl version unless you use kubectl --match-server-version explicitly.

Workaround

We use asdf kubectl to switch between kubectl versions by adding .tool-versions to folders that automatically switch between kubectl versions. For example:

  • folder cluster-a: kubectl 1.29.12
  • folder cluster-b: kubectl 1.28.15

Suggested Solution

It would be nice to be able to specify the local kubectl version/path in the kubeconfig file. For the moment there is no such field in kubeconfig.v1: https://kubernetes.io/docs/reference/config-api/kubeconfig.v1/.

I would suggest to extend cluster object by an kubectl-client attribute. It would look like this:

apiVersion: v1
clusters:
- cluster:
    server: https://1.2.3.4
  name: cluster-a
  kubectl-client: /path/to/kubectl/1.29.12
- cluster:
    server: https://5.6.7.8
  name: cluster-b
  kubectl-client: /path/to/kubectl/1.29.12
current-context: ""
kind: Config
preferences: {}

This general solution would make it possible to use different kubectl versions (binaries) per cluster. So one could use asdf, update-alternatives, brew etc.

If this issue is accepted I can build it and open a MR. But I wanted to make sure that the effort is worth it. I am already a kubernetes contributor.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 24, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

2 participants