#81 Access multiple clusters from a pod running on one of them

Closed
opened 3 weeks ago by mkanoap · 4 comments
mkanoap commented 3 weeks ago

I’ve been trying to configure kube-web-view for multiple clusters via the --kubeconfig-path argument. The kubeconfig file has contexts for each cluster and tokens for the kube-web-view service accounts for each one, including the cluster the pod is running on.

This pattern works fine for kube-ops-view and kube-resource-report, but with kube-web-view it only shows me the cluster the pod is running on, as local. It appears to ignore the kubeconfig file I pass to it.

Looking at the code, it appears that the logic is like this:
1) if clusters were passed via arguments, use that list.
2) Otherwise if clusters were passed via a registry url, use that list.
3) If neither are true, try using the service account to discover the local cluster.
4) If that attempt fails, use the kubeconfig-path argument to build the list.

In my case, since the pod is running in a valid cluster, step 3 works and the kubeconfig file defined by kubeconfig-path is never referenced. If I’m correct, step 4 will never happen if you are running in a cluster, just if you are running outside of one.

If I’m reading that right, can the logic be flipped? Only use the service account to discover the local cluster if there is no kubeconfig file provided?

I've been trying to configure kube-web-view for multiple clusters via the --kubeconfig-path argument. The kubeconfig file has contexts for each cluster and tokens for the kube-web-view service accounts for each one, including the cluster the pod is running on. This pattern works fine for kube-ops-view and kube-resource-report, but with kube-web-view it only shows me the cluster the pod is running on, as local. It appears to ignore the kubeconfig file I pass to it. Looking at the code, it appears that the logic is like this:<br> 1) if clusters were passed via arguments, use that list.<br> 2) Otherwise if clusters were passed via a registry url, use that list.<br> 3) If neither are true, try using the service account to discover the local cluster.<br> 4) If that attempt fails, use the kubeconfig-path argument to build the list. In my case, since the pod is running in a valid cluster, step 3 works and the kubeconfig file defined by kubeconfig-path is never referenced. If I'm correct, step 4 will never happen if you are running in a cluster, just if you are running outside of one. If I'm reading that right, can the logic be flipped? Only use the service account to discover the local cluster if there is no kubeconfig file provided?
so0k commented 3 weeks ago

I have this working, I have a helm chart - maybe I contribute the helm chart as suggested in the other ticket

I have this working, I have a helm chart - maybe I contribute the helm chart as suggested in the other ticket
hjacobs commented 3 weeks ago
Owner
@mkanoap did you check https://kube-web-view.readthedocs.io/en/latest/setup.html ?
hjacobs commented 3 weeks ago
Owner

OK, this is a bug! Will fix!

OK, this is a bug! Will fix!
hjacobs self-assigned this 3 weeks ago
hjacobs commented 3 weeks ago
Owner
Should be fixed in 19.9.4: https://codeberg.org/hjacobs/kube-web-view/releases
Sign in to join this conversation.
No Label
No Milestone
No Assignees
3 Participants
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
Cancel
Save
There is no content yet.