Lab 10: Challenges¶
Open-ended exercises for fast finishers, or for a second session. Each one names the files you'll
probably touch. Some need a fork (GitOps); all can be done with kubectl if not.
Networking¶
- Same-project collaboration. Allow workspaces in the same project to reach each other on
port 8888, but not across projects. Hint: a CiliumNetworkPolicy with
fromEndpointsmatchingcomponent: singleuser-server(namespace defaults to the policy's own). Test with Hubble. Discuss: is this a good idea in a TRE? - Watch a login. With
hubble observe --namespace jupyterhub --follow, log in as a user and identify every flow: hub→Keycloak, proxy→workspace, workspace→hub. - L7 rules. Write a policy allowing workspaces in alpha only
GETrequests tohttp://example.com/(plain HTTP). Hint:toFQDNs+toPorts.rules.http. Why can't you do the same for HTTPS? - Break it and fix it. Remove the
ingressTraefik rule fromgitops/network-policies/jupyterhub.yaml(fork) orkubectl edita copy. What breaks? Find the drops in Hubble, then restore it.
Workspaces¶
- Per-project images. Make project beta use
quay.io/jupyter/scipy-notebook:2026-08-10(gitops/apps/values.yaml). Why does Kyverno allow it? What would you need to change to useghcr.io/...images? - Faster culling. Stop idle servers after 10 minutes (
gitops/jupyterhub/values.yaml,cull.timeout). Why is idle culling a security control and not just a cost one? - Read-only reference data. Add a
project-dataPVC to the project chart, mount it read-only at~/datafor all workspaces (singleuser.storage.extraVolumeMountswithreadOnly: true), and discuss how data would get into it in a real TRE (the airlock). - Hardening. Add
seccompProfile: RuntimeDefault,allowPrivilegeEscalation: falseandcapabilities: {drop: [ALL]}to workspaces (singleuser.extraPodConfig/singleuser.extraContainerConfigin the JupyterHub values). Then switch the namespace label topod-security.kubernetes.io/enforce: restrictedin the project chart. Do workspaces still start? Re-run Kubescape: did the score change?
Policy¶
- Mutate. Write a Kyverno
mutatepolicy that copies ak8tre.io/cost-centreannotation from the namespace onto every pod as a label. Add the annotation to the project chart. - Protect sessions. Write a Kyverno policy that blocks
kubectl execinto workspace pods (matchPodExecOptions/ operationCONNECT). What should happen when an administrator really needs to help a user? (Think: break-glass with approval and audit.) - Test first. Add cases for your new policies to
tests/kyverno/and runkyverno test tests/kyverno(CI runs it too).
Platform¶
- Lean mode. Re-bootstrap with
KID_ENABLE_KYVERNO=falseand comparetre usage. What protections did you lose? Which remain (Pod Security, quotas, network policy)? - Drift.
kubectl edittheproject-quotain alpha to double it. How long does it last? Where would you see that it happened? (Argo CD UI → project-alpha → History and events.) - Read K8TRE. Compare
gitops/jupyterhub/files/tre_config.pywith K8TRE's JupyterHub configuration in the k8tre repository. What does K8TRE do differently (hint: the cr8tor backend, Guacamole, Kerberos) and why?