Skip to content

kubectl get --raw incorrectly truncates the server URL's path before appending the requested path #1676

@b1zzu

Description

@b1zzu

What happened:

Whether I'm running kubectl --context cluster-a get --raw "/api/v1/nodes" or kubectl --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

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions