jupyterhub / kubespawner

Kubernetes spawner for JupyterHub
https://jupyterhub-kubespawner.readthedocs.io
BSD 3-Clause "New" or "Revised" License
531 stars 299 forks source link

Support bypassing cluster local kubeconfig in favor of explicit kubeconfig #388

Open xrmzju opened 4 years ago

xrmzju commented 4 years ago

Update by @consideRatio

If KubeSpawner is to do work in another cluster, it needs a way to get passed the credentials to speak with that k8s clusters api-server. Currently our logic doesn't support this.

https://github.com/jupyterhub/kubespawner/blob/37a80abb0a6c826e5c118a068fa1cf2725738038/kubespawner/reflector.py#L125-L132

Original issue

(blank)

consideRatio commented 4 years ago

I need more details here to better think about this.

I use kubespawner from a jupyterhub living in a container in a pod in the k8s it control. I do it as part of the zero-to-jupyterhub-k8/s project. This jupyterhub pod has the rights to work on with the k8s api-server in the cluster by the RBAC details configured for the pod's service account.

Please describe your use case a bit @xrmzju, that is essential for work to be done towards it.

xrmzju commented 4 years ago

I need more details here to better think about this.

I use kubespawner from a jupyterhub living in a container in a pod in the k8s it control. I do it as part of the zero-to-jupyterhub-k8/s project. This jupyterhub pod has the rights to work on with the k8s api-server in the cluster by the RBAC details configured for the pod's service account.

Please describe your use case a bit @xrmzju, that is essential for work to be done towards it.

sry i just opened the issue for a mark yesterday. in my case, i need to deploy jupyterhub in cluster A and create notebook pod in cluster B, so kubespawner need to support load external cluster config(in my case, kubeconfig), but for now, it uses the default in cluster client.

manics commented 4 years ago

@xrmzju What happens when you specify a kubeconfig at the moment? https://github.com/jupyterhub/kubespawner/blob/37a80abb0a6c826e5c118a068fa1cf2725738038/kubespawner/reflector.py#L125-L132 implies it should already work.

xrmzju commented 4 years ago

@xrmzju What happens when you specify a kubeconfig at the moment? https://github.com/jupyterhub/kubespawner/blob/37a80abb0a6c826e5c118a068fa1cf2725738038/kubespawner/reflector.py#L125-L132

implies it should already work.

i made it work by pass api_client client = Client(api_client=config.new_client_from_config(),*args, **kwargs) in L43