Update jupyter configuration for network connection

This commit is contained in:
wbsong111
2026-05-06 09:00:16 +09:00
parent 547dc58e8b
commit 162d9b2c2a
6 changed files with 72 additions and 8 deletions
@@ -132,24 +132,24 @@ groupVolumes: []
```bash
# 렌더링 미리보기 (실제 배포 없음)
helm template my-jupyter ./manifests/helm/jupyterlab \
-f ./manifests/helm/jupyterlab/custom-values.yaml
helm template my-jupyter ./manifests/helm/jupyterlab/1.0.0 \
-f ./manifests/helm/jupyterlab/1.0.0/custom-values.yaml
# 신규 설치
helm install my-jupyter ./manifests/helm/jupyterlab \
helm install my-jupyter ./manifests/helm/jupyterlab/1.0.0 \
--namespace jupyter \
--create-namespace \
-f ./manifests/helm/jupyterlab/custom-values.yaml
-f ./manifests/helm/jupyterlab/1.0.0/custom-values.yaml
# 업그레이드
helm upgrade my-jupyter ./manifests/helm/jupyterlab \
helm upgrade my-jupyter ./manifests/helm/jupyterlab/1.0.0 \
-n jupyter \
-f ./manifests/helm/jupyterlab/custom-values.yaml
-f ./manifests/helm/jupyterlab/1.0.0/custom-values.yaml
# 변경 사항 확인 (helm-diff 플러그인 필요)
helm diff upgrade my-jupyter ./manifests/helm/jupyterlab \
helm diff upgrade my-jupyter ./manifests/helm/jupyterlab/1.0.0 \
-n jupyter \
-f ./manifests/helm/jupyterlab/custom-values.yaml
-f ./manifests/helm/jupyterlab/1.0.0/custom-values.yaml
```
## 환경별 설정 예시
@@ -20,6 +20,15 @@ resources:
jupyterConfig:
token: ""
idleCullTimeout: 3600 # 1시간 유휴 후 커널 종료 (테스트용)
idleCullInterval: 300 # 5분마다 체크
# KIC 3.x: timeout은 Kubernetes Service 어노테이션으로 설정 (단위: ms)
service:
annotations:
konghq.com/connect-timeout: "60000" # 60초
konghq.com/read-timeout: "3600000" # 1시간
konghq.com/write-timeout: "3600000" # 1시간
ingress:
enabled: true
@@ -29,6 +38,7 @@ ingress:
cert-manager.io/duration: "8760h"
cert-manager.io/renew-before: "720h"
konghq.com/https-redirect-status-code: "301"
# Kong은 https 프로토콜로 WebSocket Upgrade를 자동 처리 (wss 별도 지정 불필요)
konghq.com/protocols: "https"
hosts:
- host: "jupyter.example.com"
@@ -53,3 +63,9 @@ dataVolume:
groupVolumes: []
tcpKeepalive:
enabled: true
time: 120 # 유휴 120초 후 첫 probe 전송 (Linux 기본: 7200초)
intvl: 10 # probe 간격 10초 (Linux 기본: 75초)
probes: 6 # 6회 무응답 시 연결 종료 (Linux 기본: 9회)
@@ -10,3 +10,10 @@ data:
#!/bin/bash
apt-get update -y
python -m pip install --no-cache-dir --upgrade pip
jupyter_server_config.py: |
# Idle kernel culling
# idleCullTimeout=0: culling disabled; positive value: seconds before shutdown
c.MappingKernelManager.cull_idle_timeout = {{ int .Values.jupyterConfig.idleCullTimeout }}
c.MappingKernelManager.cull_interval = {{ int .Values.jupyterConfig.idleCullInterval }}
# Do not cull kernels that have an active connection (browser tab open)
c.MappingKernelManager.cull_connected = False
@@ -19,6 +19,15 @@ spec:
securityContext:
runAsUser: 1000
fsGroup: 100
{{- if .Values.tcpKeepalive.enabled }}
sysctls:
- name: net.ipv4.tcp_keepalive_time
value: {{ .Values.tcpKeepalive.time | quote }}
- name: net.ipv4.tcp_keepalive_intvl
value: {{ .Values.tcpKeepalive.intvl | quote }}
- name: net.ipv4.tcp_keepalive_probes
value: {{ .Values.tcpKeepalive.probes | quote }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
@@ -63,6 +72,10 @@ spec:
- name: startup-script
mountPath: /usr/local/bin/start-notebook.d/startup-script.sh
subPath: startup-script.sh
- name: startup-script
mountPath: /etc/jupyter/jupyter_server_config.py
subPath: jupyter_server_config.py
readOnly: true
{{- if .Values.homeVolume.enabled }}
- name: home-volume
mountPath: {{ include "jupyterlab.homeDir" . }}
@@ -5,6 +5,10 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "jupyterlab.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: ClusterIP
selector:
@@ -30,6 +30,19 @@ resources:
jupyterConfig:
# Access token (leave empty to disable token authentication)
token: ""
# Idle kernel culling: seconds of inactivity before kernel is shut down (0 = disabled)
idleCullTimeout: 0
# Interval in seconds to check for idle kernels (only effective when idleCullTimeout > 0)
idleCullInterval: 300
# Kubernetes Service annotations.
# KIC 2.x+ reads timeout annotations from the Service resource (not Ingress).
# Values must be in milliseconds.
service:
annotations:
konghq.com/connect-timeout: "60000"
konghq.com/read-timeout: "60000"
konghq.com/write-timeout: "60000"
# External access Ingress configuration
ingress:
@@ -77,5 +90,16 @@ groupVolumes: []
# /dev/shm shared memory size limit (e.g. "512Mi", "1Gi"). Leave empty for no limit.
shmSizeLimit: "512Mi"
# TCP keepalive tuning at the Pod level.
# Requires kubelet flag: --allowed-unsafe-sysctls=net.ipv4.tcp_keepalive_time,net.ipv4.tcp_keepalive_intvl,net.ipv4.tcp_keepalive_probes
tcpKeepalive:
enabled: false
# Seconds of idle before the first keepalive probe is sent (Linux default: 7200)
time: 120
# Seconds between consecutive keepalive probes (Linux default: 75)
intvl: 10
# Number of unanswered probes before the connection is dropped (Linux default: 9)
probes: 6
# imagePullSecrets for private registries
imagePullSecrets: []