karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.37k stars 865 forks source link

Error when using cluster proxy #5228

Closed spiritNO1 closed 1 week ago

spiritNO1 commented 1 month ago

I am testing the aggregated api service using kubectl, the following command can work and return normal value: k get --raw /apis/cluster.karmada.io/v1alpha1/clusters/member1/proxy/api/v1/namespaces/test/pods/test_pod

and the following command can work too: k get --raw /apis/cluster.karmada.io/v1alpha1/clusters/*/proxy/api/v1/namespaces/test/pods/

but the following command can not work, and the error is "Error from server (NotFound): the server could not find the requested resource": k get --raw /apis/cluster.karmada.io/v1alpha1/clusters/*/proxy/api/v1/namespaces/test/pods/test_pod

spiritNO1 commented 1 month ago

I find the reason, the cluster spec.apiEndpoint cannot with / at the end the following is true: apiEndpoint: https://XXX:6443 and the following is wrong: apiEndpoint: https://XXX:6443/

spiritNO1 commented 1 month ago

image image urlStr is parsed from cluster spec.apiEndpoint

RainbowMango commented 1 month ago

Good for you! @spiritNO1 and thanks for the information.

cc @XiShanYongYe-Chang here to see if we need some enhancement.

XiShanYongYe-Chang commented 1 month ago

Hi @spiritNO1, I tested it and found it to be okay.

image

spiritNO1 commented 1 month ago

@XiShanYongYe-Chang apiEndpoint of the cluster config should with '/' at the end

spiritNO1 commented 1 month ago

@XiShanYongYe-Chang apiEndpoint of the cluster config should with '/' at the end

XiShanYongYe-Chang commented 1 month ago

apiEndpoint of the cluster config should with '/' at the end

Thanks, I get it.

Would you like to contribute?

spiritNO1 commented 1 month ago

@XiShanYongYe-Chang Very glad to