jupyter-notebook.yaml
## Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jupyter-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: jupyter-notebook-service 
            port:
              number: 80
---
## Service

apiVersion: v1
kind: Service
metadata:
  name: jupyter-notebook-service
spec:  
  clusterIP: None
  selector:
    app: jupyter-notebook
  ports:
  - protocol: TCP    
    port: 80 
    targetPort: 8888
---
## StatefulSet

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jupyter-notebook
  labels:
    app: jupyter-notebook
spec:
  replicas: 1
  serviceName: "jupyter-notebook-service"
  selector:
    matchLabels:
      app: jupyter-notebook
  template:
    metadata:
      labels:
        app: jupyter-notebook
    spec:
      securityContext:
        fsGroup: 1000
      volumes:
        - name: jupyter-pv-storage
          persistentVolumeClaim:
            claimName: jupyter-pv-claim 
      containers:
      - name: minimal-notebook
        image: jupyter/pyspark-notebook:latest
        ports:
        - containerPort: 8888
        command: ["start-notebook.sh"]
        args: ["--NotebookApp.token=''"]
        volumeMounts:
          - mountPath: "/home/jovyan"
            name: jupyter-pv-storage

---
## PersistentVolumeClaim

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jupyter-pv-claim
spec:
  accessModes:
  - ReadWriteOnce 
  resources:
    requests:
      storage: 1Gi


  • No labels