kubectl config set-cluster --certificate-authority forces relative path #1644
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
triage/needs-information
Indicates an issue needs more information in order to work on it.
What happened:
Assuming the kube config file is in the standard path
%USERPROFILE%\.kube\config
, usingkubectl config set-cluster minikube --certificate-authority=C:\\Users\\username\\.minikube\\ca.crt
will persistcertificate-authority: ..\.minikube\ca.crt
for the cluster in the kube config. I found an issue explaining that this was done intentionally kubernetes/kubernetes#75552, but it breaks some kubectl functionality, namelykubectl config view --flatten
run in the user's home directory produces the output:Note that I am using minikube for simplicity with the example/repro, but this issue exists regardless of the cluster you are attempting to configure.
What you expected to happen:
kubectl config view --flatten
should work and not be broken with this relative path, since it is correct relative to the.kube/config
file. But in my opinion, kubectl should also not assume it knows better and change the path passed in by the user, the user may have a specific reason for supplying an absolute path and I think kubectl should just respect the input provided by the user.How to reproduce it (as minimally and precisely as possible):
Have an existing kube cluster in your context named
minikube
and set as the current context.Have a minikube ca cert available in the standard path
%USERPROFILE%\.minikube\ca.crt
Manually set the certificate authority for the cluster using an absolute path:
Now the following command will fail because of the relative path for the certificate authority in the kube context.
Environment:
kubectl version
): 1.31.0cat /etc/os-release
): Windows 11 amd64The text was updated successfully, but these errors were encountered: