Dev pod
An interactive Pod you apply with kubectl and reach through port-forward, with no Git, ArgoCD, Service or Ingress. Use it for work you will delete within hours or days. For anything long-lived, use a Long-running service. The same manifest works for RStudio Server or code-server: change the image and port.
Manifest
Section titled “Manifest”Save it outside your workload repo and replace <tenant>.
apiVersion: v1kind: Podmetadata: name: jupyter namespace: <tenant>-dev labels: app: jupyterspec: priorityClassName: uber-user-significant # never preempts other Pods securityContext: # PodSecurity restricted, enforced by Kyverno runAsNonRoot: true runAsUser: 1000 # jovyan fsGroup: 100 # jovyan's group; makes a Cinder PVC writable fsGroupChangePolicy: OnRootMismatch seccompProfile: type: RuntimeDefault containers: - name: notebook image: quay.io/jupyter/minimal-notebook:2024-08-19 ports: - containerPort: 8888 securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true # optional hardening; needs the writable mounts below capabilities: drop: [ALL] resources: requests: cpu: 500m memory: 1Gi limits: cpu: 2 memory: 4Gi volumeMounts: - name: home mountPath: /home/jovyan - name: tmp mountPath: /tmp volumes: - name: home emptyDir: {} # deleted with the Pod - name: tmp emptyDir: {}To keep notebooks after the Pod is deleted, create a PVC (Persistent volumes) and use it for home:
- name: home persistentVolumeClaim: claimName: jupyter-homeA fresh Cinder volume is root:root 0755. The fsGroup line is what lets Jupyter, running as UID 1000, write to it.
Run it
Section titled “Run it”kubectl create namespace <tenant>-dev # if it doesn't exist yetkubectl apply -f dev-pod.yamlkubectl wait --for=condition=Ready pod/jupyter -n <tenant>-dev --timeout=5mkubectl logs jupyter -n <tenant>-dev | grep token=kubectl port-forward -n <tenant>-dev pod/jupyter 8888:8888Open http://localhost:8888/lab?token=<token>. If the port-forward drops, run it again; the session lives as long as the Pod.
Clean up
Section titled “Clean up”Download anything you want to keep (File → Download), then:
kubectl delete pod jupyter -n <tenant>-devThe emptyDir volumes and their contents go with the Pod. A PVC stays until you delete it.
If something goes wrong
Section titled “If something goes wrong”| Symptom | Cause and fix |
|---|---|
kubectl apply fails with a validate.kyverno.svc-fail PodSecurity denial | A required securityContext field is missing. Restore it from the manifest above. |
Jupyter reports Permission denied | /home/jovyan isn’t writable: check the home mount, and fsGroup if it is a PVC. |
For other messages, see the Troubleshooting index.