-
Notifications
You must be signed in to change notification settings - Fork 924
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
kubectl get --raw incorrectly truncates the server URL's path before appending the requested path #1676
Comments
Can't reproduce it. Could you provide more log? |
This is the best example I have
And this is my cluster definition in the kubeconfig:
As you can see when using the |
At first, I thought I couldn't reproduce it either. It worked fine when I created two kind clusters and specified the context, but kind server urls don't have a path like yours does. I found in the code that when you perform a get with I think the intended behavior would be for it to append the requested path, preserving any existing path that is part of the server URL. So something like this: Rancher must be doing something to handle when you don't specify the cluster so that it doesn't outright fail (choosing some default cluster? or the first one?). That's the only reason I can think why your request would not just fail, but instead run against a different cluster altogether. I do think this is a bug in kubectl/client-go though, that should be fixed. @b1zzu Can you try this and see if it returns the result you expect?
I know it isn't ideal, but I think that might work. |
Hi @brianpursley, I've tried using
and it reaches the expected (non-prod-eks-tooling) cluster. Personally, I expected the --raw to concat the cluster path with the request raw path, exactly like your example. But for now I can also use the full-path as workaround like you have suggested. |
I'd like to work on this. @brianpursley I hope it's OK to assign myself. /assign |
What happened:
Whether I'm running
kubectl --context cluster-a get --raw "/api/v1/nodes"
orkubectl --context cluster-b get --raw "/api/v1/nodes"
it always returns the nodes from cluster-a.Same if I switch context:
kubectl config use-context cluster-b
What you expected to happen:
I expect to see the nodes form the selected context
How to reproduce it (as minimally and precisely as possible):
Have two clusters, and two contexts that shares the same authentication method.
Anything else we need to know?:
Environment:
Client Version: v1.31.2
Kustomize Version: v5.4.2
Server Version: v1.31.0
NAME="Fedora Linux"
VERSION="41 (Workstation Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=41
VERSION_CODENAME=""
PLATFORM_ID="platform:f41"
PRETTY_NAME="Fedora Linux 41 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:41"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=41
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=41
SUPPORT_END=2025-05-13
VARIANT="Workstation Edition"
VARIANT_ID=workstation
The text was updated successfully, but these errors were encountered: