Here be magic incantations of yore

Accessing data in notebook containers

Bring your own (BYO) IAM role

unset AWS_WEB_IDENTITY_TOKEN_FILE
unset AWS_ROLE_ARN

Debugging

Print JupyterLab logs

Error making request Unexpected end of JSON input Check the JupyterLab log for more details

kubectl logs pod/${HOSTNAME} -f

Because Kubeflow doesn’t have an “edit workbench UI”

Here be spells to modify your workbench

Increase memory limit to 8 GB

[kubectl patch notebook $(echo $NB_PREFIX | cut -d'/' -f4) --type=json --patch '[{"op": "replace", "path": "/spec/template/spec/containers/0/resources/limits/memory", "value": "8Gi"}]'](<https://kflowai.notion.site/60f8ea40341c447db452adcddabbd58a>)

⚠️ DANGER DANGER: privilege escalation to root

kubectl patch notebook $(echo $NB_PREFIX | cut -d'/' -f4) --type=json --patch '[{"op": "add", "path": "/spec/template/spec/securityContext", "value": {"runAsNonRoot": false, "runAsUser": 0}}]'

and the anti-curse:

kubectl patch notebook $(echo $NB_PREFIX | cut -d'/' -f4) --type=json --patch '[{"op": "remove", "path": "/spec/template/spec/securityContext"}]'

Finding Your Namespace

From within a Kubeflow Notebook or pipeline component, the current namespace is available in the file: /var/run/secrets/kubernetes.io/serviceaccount/namespace