kubewharf / kubeadmiral

Multi-Cluster Kubernetes Orchestration
https://kubeadmiral.io
Apache License 2.0
816 stars 97 forks source link

feat: Provide proxy APIs for users to access member cluster resources #309

Open zhy76 opened 10 months ago

zhy76 commented 10 months ago

What would you like to be added?

Provide proxy API for users to access member cluster resources

Why is this needed?

Users may need to check the distribution of application resources in each member cluster. And Users do not want to log in to each cloud provider’s website or switch the kubeconfig context. It will greatly improve the convenience for users to use kubeAdmiral if we provide the proxy APIs to access member cluster resources.

Fixes: #261

A new aggregated apiserver component is introduced to implement the capabilities of proxy API for users to access member cluster resources.

Usage

You can use make local-up to try it.

  1. Run the following command (replace {clustername} with your actual clustername) :
    kubectl get --kubeconfig $HOME/.kube/kubeadmiral/kubeadmiral.config --context kubeadmiral-host --raw /apis/aggregated.kubeadmiral.io/v1alpha1/aggregations/{clustername}/proxy/api/v1/nodes(pods, services etc.)

    example:

    kubectl get --kubeconfig $HOME/.kube/kubeadmiral/kubeadmiral.config --context kubeadmiral-host --raw /apis/aggregated.kubeadmiral.io/v1alpha1/aggregations/kubeadmiral-member-1/proxy/api/v1/nodes
  2. You will get resources in member cluster. image

cc @mrlihanbo