#author("2024-12-28T08:07:37+00:00","default:iseki","iseki") ** JupyterHub on Kubernetes (on-premises) [#zff0b408] - https://zero-to-jupyterhub.readthedocs.io/en/latest/ *** helm [#wb0768ae] - vi [[config.yaml>./config.yaml]] **** Repository [#p33f5bb6] helm repo add jupyterhub https://jupyterhub.github.io/helm-chart/ helm repo update helm repo list **** Install [#da21392e] helm upgrade --cleanup-on-fail --install jhub jupyterhub/jupyterhub --namespace k8sns --create-namespace --version=1.1.3 --values config.yaml - jhub : release name - k8sns : namespace - helm list -n k8sns **** Upgrade [#k0ed55cd] helm upgrade --cleanup-on-fail jhub jupyterhub/jupyterhub --namespace k8sns --version=1.1.3 --values config.yaml **** config.yaml [#f0df1263] - config.yaml は実行する度に使設定されるみたい. - 削除する設定は明確に書く! *** Volume [#eeaa0542] - 以下を名前を変えて2セット作る (Hub用とnotebook用) - helm で先にPODをインストールし,その後にVolumeを作って,helm でPODをアップグレードする?(namespace が決まらないので) **** Install [#g66bee29] helm upgrade --cleanup-on-fail --install jhub jupyterhub/jupyterhub --namespace k8sns --create-namespace --version=1.1.3 --values config.yaml **** Upgrade [#p315ca56] helm upgrade --cleanup-on-fail jhub jupyterhub/jupyterhub -n k8sns --version=1.1.3 --values config.yaml^C **** StorageClass [#jf2ee55b] - sc-lv.yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.kubernetes.io/is-default-class: "true" name: local-storage (ここの名前を変える) provisioner: kubernetes.io/no-provisioner volumeBindingMode: WaitForFirstConsumer - kubectl -n (namespace) create -f sc-lv.yaml -- kubectl get sc **** PersistentVolume [#g3fef990] - pv-lv.yaml apiVersion: v1 kind: PersistentVolume metadata: name: local-pv (ここを変える) spec: capacity: storage: 1Gi # volumeMode field requires BlockVolume Alpha feature gate to be enabled. volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: local-storage (ここを変える.対応する sc の名前にする) hostPath: path: /data/pv0001 (ここを変える) type: DirectoryOrCreate #local: # path: /data nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - comet (ノードの名前) - kubectl -n (namespace) create -f pv-lv.yaml -- kubectl get pv **** PersistentVolumeClaim [#w18a5036] - pvc-lv.yamal apiVersion: v1 kind: PersistentVolumeClaim metadata: name: hub-db-dir (hub用) #name: claim-iseki (notebook用) spec: storageClassName: local-storage (対応する sc の名前にする) accessModes: - ReadWriteOnce resources: requests: storage: 1Gi volumeMode: Filesystem - kubectl -n (namespace) create -f pvc-lv.yaml -- kubectl get pvc **** 削除 [#q41089d9] - kube -n (namespace) delete [sc, pv, pvc] (name) - kube -n (namespace) delete [sc, pv, pvc] --all