diff --git a/charts/kserve/.helmignore b/charts/kserve/.helmignore new file mode 100644 index 0000000..691fa13 --- /dev/null +++ b/charts/kserve/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ \ No newline at end of file diff --git a/charts/kserve/CUSTOM-README.md b/charts/kserve/CUSTOM-README.md new file mode 100644 index 0000000..8eb553e --- /dev/null +++ b/charts/kserve/CUSTOM-README.md @@ -0,0 +1,57 @@ +# KServe 배포 + +## 1. 배포 방법 + +- 명령어 + + ```sh + $ helm upgrade --install kserve ../kserve \ + --namespace kserve \ + --create-namespace \ + -f custom-values.yaml + ``` + +## 2. custom-values.yaml 설명 + +- custom-values.yaml에 정의된 값에 대한 설명입니다. + +### 1) InferenceService 설정 + +| Name | 설명 | 기본값 | +| ----------------------- | --------------------- | ------------------- | +| `inferenceService.name` | InferenceService 이름 | `huggingface-model` | + +### 2) 모델 설정 + +| Name | 설명 | 기본값 | +| ----------------------------------- | --------------------- | ---------------------------- | +| `inferenceService.model.args[0]` | 모델 서빙 백엔드 설정 | `--backend=vllm` | +| `inferenceService.model.args[1]` | 사용할 모델 이름 | `--model_name=phi-1.5` | +| `inferenceService.model.args[2]` | 데이터 타입 설정 | `--dtype=float16` | +| `inferenceService.model.storageUri` | 모델 파일 저장 위치 | `pvc://model-volume/phi-1_5` | +| `inferenceService.model.image` | 모델 서빙 이미지 | `kserve/huggingfaceserver:v0.15.0-gpu` | + +### 3) 리소스 설정 + +| Name | 설명 | 기본값 | +| ---------------------------------------------------- | ------------------ | ------ | +| `inferenceService.resources.limits.cpu` | CPU 리소스 제한 | `8` | +| `inferenceService.resources.limits.memory` | 메모리 리소스 제한 | `16Gi` | +| `inferenceService.resources.limits.nvidia.com/gpu` | GPU 리소스 제한 | `1` | +| `inferenceService.resources.requests.cpu` | CPU 리소스 요청 | `4` | +| `inferenceService.resources.requests.memory` | 메모리 리소스 요청 | `8Gi` | +| `inferenceService.resources.requests.nvidia.com/gpu` | GPU 리소스 요청 | `1` | + +### 4) Ingress 설정 + +| Name | 설명 | 기본값 | +| ---------------------------------------------------- | -------------------------------------- | ------------------------------ | +| `ingress.annotations.cert-manager.io/cluster-issuer` | TLS 인증서 발급을 위한 클러스터 이슈어 | `root-ca-issuer` | +| `ingress.hosts[0].host` | Ingress 호스트 | `phi15.default.hopt.paasup.io` | +| `ingress.tls.secretName` | TLS 인증서 시크릿 이름 | `custom-kserve-tls` | + +## 3. 참고 사항 + +- 이 custom-values.yaml 파일은 기본 values.yaml 파일의 일부 설정만 오버라이드합니다. +- 다른 설정을 변경하려면 values.yaml 파일을 참고하여 custom-values.yaml 파일에 추가하세요. +- 모델 및 리소스 설정은 사용 환경에 맞게 조정하는 것이 좋습니다. diff --git a/charts/kserve/Chart.yaml b/charts/kserve/Chart.yaml new file mode 100644 index 0000000..70ae60b --- /dev/null +++ b/charts/kserve/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: kserve +description: A Helm chart for deploying KServe InferenceService on Kubernetes +type: application +version: 0.1.0 +appVersion: "0.15.0" \ No newline at end of file diff --git a/charts/kserve/custom-values.yaml b/charts/kserve/custom-values.yaml new file mode 100644 index 0000000..b11caf8 --- /dev/null +++ b/charts/kserve/custom-values.yaml @@ -0,0 +1,29 @@ +# KServe Custom Values +inferenceService: + name: "phi-1_5" + + model: + args: + - --backend=vllm + - --model_name=phi-1_5 + - --dtype=float16 + storageUri: "pvc://model-volume/phi-1_5" + image: kserve/huggingfaceserver:v0.15.0-gpu + + resources: + limits: + cpu: "8" + memory: 16Gi + nvidia.com/gpu: "1" + requests: + cpu: "4" + memory: 8Gi + nvidia.com/gpu: "1" + +ingress: + annotations: + cert-manager.io/cluster-issuer: "root-ca-issuer" + hosts: + - host: "phi15.default.hopt.paasup.io" + tls: + secretName: custom-kserve-tls diff --git a/charts/kserve/templates/NOTES.txt b/charts/kserve/templates/NOTES.txt new file mode 100644 index 0000000..e0df3a7 --- /dev/null +++ b/charts/kserve/templates/NOTES.txt @@ -0,0 +1,11 @@ +KServe InferenceService {{ .Values.inferenceService.name }} has been deployed. + +InferenceService is available at: + http://{{ .Values.inferenceService.name }}-predictor.{{ .Values.inferenceService.namespace }}.svc.cluster.local/v1/models/{{ .Values.inferenceService.name }}:predict + +{{- if .Values.ingress.enabled }} +Ingress has been configured to access the InferenceService: + {{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls.enabled }}s{{ end }}://{{ .host }}/ + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/kserve/templates/_helpers.tpl b/charts/kserve/templates/_helpers.tpl new file mode 100644 index 0000000..c8a711c --- /dev/null +++ b/charts/kserve/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "kserve.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "kserve.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kserve.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kserve.labels" -}} +helm.sh/chart: {{ include "kserve.chart" . }} +{{ include "kserve.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kserve.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kserve.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} \ No newline at end of file diff --git a/charts/kserve/templates/inferenceservice.yaml b/charts/kserve/templates/inferenceservice.yaml new file mode 100644 index 0000000..535899b --- /dev/null +++ b/charts/kserve/templates/inferenceservice.yaml @@ -0,0 +1,24 @@ +apiVersion: serving.kserve.io/v1beta1 +kind: InferenceService +metadata: + name: {{ include "kserve.fullname" . }} + annotations: + queue.sidecar.serving.knative.dev/resourcePercentage: "10" + labels: + {{- include "kserve.labels" . | nindent 4 }} +spec: + predictor: + runtimeClassName: {{ .Values.inferenceService.runtimeClassName }} + model: + modelFormat: + name: {{ .Values.inferenceService.model.modelFormat.name }} + {{- with .Values.inferenceService.model.args }} + args: + {{- toYaml . | nindent 8 }} + {{- end }} + storageUri: {{ .Values.inferenceService.model.storageUri }} + {{- if .Values.inferenceService.model.image }} + image: {{ .Values.inferenceService.model.image }} + {{- end }} + resources: + {{- toYaml .Values.inferenceService.resources | nindent 8 }} \ No newline at end of file diff --git a/charts/kserve/templates/ingress.yaml b/charts/kserve/templates/ingress.yaml new file mode 100644 index 0000000..020e722 --- /dev/null +++ b/charts/kserve/templates/ingress.yaml @@ -0,0 +1,34 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "kserve.fullname" . }} + namespace: {{ .Values.ingress.namespace }} + labels: + {{- include "kserve.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.ingress.annotations | nindent 4 }} +spec: + ingressClassName: {{ .Values.ingress.className }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host }} + http: + paths: + - backend: + service: + name: {{ $.Values.ingress.backend.service.name }} + port: + number: {{ $.Values.ingress.backend.service.port }} + path: / + pathType: Prefix + {{- end }} + {{- if .Values.ingress.tls.enabled }} + tls: + - hosts: + {{- range .Values.ingress.hosts }} + - {{ .host }} + {{- end }} + secretName: {{ .Values.ingress.tls.secretName }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/kserve/values.yaml b/charts/kserve/values.yaml new file mode 100644 index 0000000..a2ae5e4 --- /dev/null +++ b/charts/kserve/values.yaml @@ -0,0 +1,57 @@ +# Default values for kserve. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# KServe InferenceService 설정 +inferenceService: + # InferenceService 이름 + name: huggingface-model + + # 네임스페이스 + namespace: default + + # Runtime Class Name + runtimeClassName: nvidia + + # 모델 설정 + model: + modelFormat: + name: huggingface + args: + - --backend=vllm + - --model_name=phi-1.5 + - --dtype=float16 + storageUri: "pvc://model-volume/phi-1_5" + image: kserve/huggingfaceserver:v0.15.0-gpu + + # 리소스 설정 + resources: + limits: + cpu: "8" + memory: 16Gi + nvidia.com/gpu: "1" + requests: + cpu: "4" + memory: 8Gi + nvidia.com/gpu: "1" + +# Ingress 설정 +ingress: + enabled: true + namespace: istio-system + className: "kong" + annotations: + cert-manager.io/cluster-issuer: kubeflow-self-signing-issuer + hosts: + - host: "demo01-test1.hopt.paasup.io" + backend: + service: + name: istio-ingressgateway + port: 80 + tls: + enabled: true + secretName: kserve-tls + +# 이름 오버라이드 설정 +nameOverride: "" +fullnameOverride: "" \ No newline at end of file diff --git a/charts/nim/custom-values.yaml b/charts/nim/custom-values.yaml index 0e41b01..56ee713 100644 --- a/charts/nim/custom-values.yaml +++ b/charts/nim/custom-values.yaml @@ -2,6 +2,19 @@ nimService: name: "$nimService.name" existingAuthSecret: "$INFISICAL_SECRET" + # Environment variables for the NIMService + env: + - name: NIM_GUIDED_DECODING_BACKEND + value: fast_outlines + - name: NIM_PEFT_SOURCE + value: http://nemo-entity-store:8000 + - name: NIM_SERVED_MODEL_NAME + value: "$nimService.servModelName" + - name: NIM_MODEL_NAME + value: "$nimService.modelName" + - name: NIM_PEFT_REFRESH_INTERVAL + value: "30" + # Example 1: Create a new PVC (leave existingPVC empty) existingPVC: "" # storage: diff --git a/charts/nim/templates/nimservice.yaml b/charts/nim/templates/nimservice.yaml index 31758f6..f29853f 100644 --- a/charts/nim/templates/nimservice.yaml +++ b/charts/nim/templates/nimservice.yaml @@ -9,7 +9,7 @@ spec: {{- toYaml .Values.nimService.labels | nindent 4 }} image: repository: {{ .Values.image.repository }} - tag: {{ .Values.image.tag | default .Chart.AppVersion }} + tag: {{ .Values.image.tag | quote }} pullPolicy: {{ .Values.image.pullPolicy }} pullSecrets: {{- range .Values.imagePullSecrets }} @@ -30,6 +30,10 @@ spec: volumeAccessMode: {{ .Values.nimService.storage.pvc.volumeAccessMode }} {{- end }} runtimeClassName: {{ .Values.nimService.runtimeClassName }} + {{- if .Values.nimService.env }} + env: + {{- toYaml .Values.nimService.env | nindent 4 }} + {{- end }} resources: {{- toYaml .Values.nimService.resources | nindent 4 }} expose: diff --git a/charts/nim/values.yaml b/charts/nim/values.yaml index 6ace0f2..abf0910 100644 --- a/charts/nim/values.yaml +++ b/charts/nim/values.yaml @@ -17,6 +17,19 @@ nimService: existingAuthSecret: "" authSecret: ngc-api + # Environment variables for the NIMService + env: + - name: NIM_GUIDED_DECODING_BACKEND + value: fast_outlines + - name: NIM_PEFT_SOURCE + value: http://nemo-entity-store:8000 + - name: NIM_SERVED_MODEL_NAME + value: meta/llama-3.2-1b-instruct + - name: NIM_MODEL_NAME + value: meta/llama-3.2-1b-instruct + - name: NIM_PEFT_REFRESH_INTERVAL + value: "30" + # If existingPVC is set, the PVC with this name will be used # If empty, a new PVC will be created with the configuration in storage.pvc existingPVC: ""