You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tutorial illustrates various scenarios and configuration options when using JupyterHub on Kubernetes.
17
6
The custom resources and configuration settings that are discussed here are based on the JupyterHub-Keycloak demo, so you may find it helpful to have that demo running to reference things as you read through this tutorial.
18
7
@@ -55,7 +44,7 @@ The keycloak and jupyterhub endpoints are defined in the jupyter hub chart value
55
44
This can be achieved by having the keycloak deployment write out its co-ordinates into a ConfigMap during start-up, which can then be referenced by the JupyterHub chart like this:
56
45
57
46
[source,yaml]
58
-
---
47
+
----
59
48
options:
60
49
hub:
61
50
config:
@@ -94,8 +83,11 @@ options:
94
83
95
84
=== Discovery
96
85
97
-
As mentioned above, keycloak writes out it endpoint information to ConfigMap, like this:
86
+
As mentioned above, keycloak writes out its endpoint information to a ConfigMap, shown in the code section below.
98
87
88
+
.Writing the ConfigMap
89
+
[%collapsible]
90
+
====
99
91
[source,yaml]
100
92
----
101
93
---
@@ -140,6 +132,8 @@ kind: Deployment
140
132
wait
141
133
done
142
134
----
135
+
====
136
+
143
137
144
138
=== Security
145
139
@@ -255,12 +249,16 @@ options:
255
249
...
256
250
----
257
251
252
+
image::../images/jupyterhub/sign-up.png[Create a user]
253
+
258
254
Users must either be included in an `allowed_users` list, or the property `allow_all` must be set to `true`.
259
255
The creation of new users will be checked against these settings and refused if appropriate.
260
256
If an admin_users property is defined, then associated users will see an additional tab on the JupyterHub home screen, allowing them to carry out user management actions (e.g. create user groups and assign users to them, assign users to the admin role, delete users).
NOTE: The above applies to version 4.x of the JupyterHub Helm chart.
263
-
Version 3.x does not impose these limitations and users can be added and used without any constraints.
261
+
Version 3.x does not impose these limitations and users can be added and used without specifying `allowed_users` or `allow_all`.
264
262
265
263
==== OAuth Authenticator (Keycloak)
266
264
@@ -273,8 +271,85 @@ To authenticate against a Keycloak instance it is necessary to provide the follo
273
271
274
272
=== GenericOAuthenticator
275
273
274
+
This section of the JupyterHub values specifies that we are using GenericOAuthenticator for our authentication.
275
+
276
+
[source,yaml]
277
+
----
278
+
...
279
+
hub:
280
+
config:
281
+
Authenticator:
282
+
# don't filter here: delegate to Keycloak
283
+
allow_all: true # <1>
284
+
admin_users:
285
+
- isla.williams # <2>
286
+
GenericOAuthenticator:
287
+
client_id: jupyterhub
288
+
client_secret: ...
289
+
username_claim: preferred_username
290
+
scope:
291
+
- openid # <3>
292
+
JupyterHub:
293
+
authenticator_class: generic-oauth # <4>
294
+
...
295
+
----
296
+
297
+
<1> We need to either provide a list of users using `allowed_users`, or to explicitly allow _all_ users, as done here.
298
+
We will delegate this to Keycloak so that we do not have to maintain users in two places.
299
+
<2> Each admin user will have access to an "Admin" tab on the JupyterHub UI where certain user-management actions can be carried out.
300
+
<3> Define the Keycloak scope
301
+
<4> Specifies which authenticator class to use
302
+
303
+
The endpoints can be defined directly under `GenericOAuthenticator` as well, though for our purposes we will set them in a configuration script (see below).
304
+
276
305
=== Certificates
277
306
307
+
The demo uses a self-signed certificate that needs to be accepted by JupyterHub.
308
+
This involves:
309
+
310
+
* mounting a secret created with the same secret class as used for the self-signed certificate used by Keycloak
311
+
* make this secret available to JupyterHub
312
+
* it may also be necessary to point python at this specific certificate
<1> Specify which certificate(s) should be used internally (in the code above this is using the default certificate, but is included for the sake of completion)
348
+
<2> Create the certificate with the same secret class (`tls`) as Keycloak
349
+
<3> Mount this certificate.
350
+
If the default file is not overwritten, but is mounted to a new file in the same directory, then the certificates should be updated by calling e.g. `update-ca-certificates`.
0 commit comments