Skip to content

Conversation

EmmanuelKasper
Copy link

When binder is installed with the helm chart, and is only exposed via a ClusterIP Kubernetes Service, the kubectl commands of the post install notes are erroring in subtle ways:

kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}"

can fail because {{ template "fullname" . }} does not always match the hardcoded labels we set in

and

kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} 

always fails because we don't expose set or expose an externalPort field in

This commit fixes the two errors by using immutables, non-overridables values from the helm templates.

…fields correctly:

When binder is installed with the helm chart, and is only exposed via a ClusterIP Kubernetes Service,
the `kubectl` commands of the post install notes are erroring in subtle ways:

~~~
kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}"
~~~

can fail because {{ template "fullname" . }} does not always match the hardcoded labels we set
in https://github.com/jupyterhub/binderhub/blob/33bcc37c2fd18573d19a13c5a41b1d8d563c3663/helm-chart/binderhub/templates/deployment.yaml#L20

and

~~~
kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }}
~~~

always fails because we don't expose set or expose an  externalPort field in https://github.com/jupyterhub/binderhub/blob/33bcc37c2fd18573d19a13c5a41b1d8d563c3663/helm-chart/binderhub/values.yaml#L34

This commit fixes the two errors by using immutables, non-overridables values from the helm templates.
@EmmanuelKasper
Copy link
Author

To reproduce the issue, and verify the fix, it should be enough to change in
testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml the nodePort service to a ClusterIP service in this way:

 service:
  type: ClusterIP

and install the helm chart following https://binderhub.readthedocs.io/en/latest/contribute.html#develop-helm-chart

@EmmanuelKasper
Copy link
Author

@rgaiacs thanks for taking the time to review this, is there anything I need to do to get this merged ?

@rgaiacs
Copy link
Contributor

rgaiacs commented Aug 26, 2025

is there anything I need to do to get this merged ?

I would like a review of another contributor as I'm a beginner regarding Kubernetes.

@minrk minrk merged commit 49414ec into jupyterhub:main Sep 3, 2025
15 checks passed
@minrk
Copy link
Member

minrk commented Sep 3, 2025

Thanks!

@EmmanuelKasper
Copy link
Author

Thanks for the review !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants