kubespawner icon indicating copy to clipboard operation
kubespawner copied to clipboard

Support bypassing cluster local kubeconfig in favor of explicit kubeconfig

Open xrmzju opened this issue 5 years ago • 4 comments

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)

xrmzju avatar Jan 07 '20 03:01 xrmzju

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.

consideRatio avatar Jan 07 '20 12:01 consideRatio

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.

xrmzju avatar Jan 07 '20 13:01 xrmzju

@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.

manics avatar Jan 07 '20 14:01 manics

@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

xrmzju avatar Jan 08 '20 07:01 xrmzju