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..175b77a --- /dev/null +++ b/charts/kserve/CUSTOM-README.md @@ -0,0 +1,56 @@ +# KServe 배포 + +## 1. 배포 방법 + +- 명령어 + + ```sh + $ helm upgrade --install kserve ./charts/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` | + +### 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.host.domain` | Ingress 호스트 도메인 | `kserve.example.com` | +| `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..aef5ca8 --- /dev/null +++ b/charts/kserve/custom-values.yaml @@ -0,0 +1,28 @@ +# KServe Custom Values +inferenceService: + name: "custom-huggingface-model" + + model: + args: + - --backend=vllm + - --model_name=llama-2-7b + - --dtype=float16 + storageUri: "pvc://custom-model-volume/llama-2-7b" + + 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" + host: + domain: "kserve.example.com" + 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..814f495 --- /dev/null +++ b/charts/kserve/templates/NOTES.txt @@ -0,0 +1,9 @@ +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: + http{{ if .Values.ingress.tls.enabled }}s{{ end }}://{{ if .Values.ingress.host.wildcard }}*.{{ end }}{{ .Values.ingress.host.domain }}/ +{{- 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..4626065 --- /dev/null +++ b/charts/kserve/templates/inferenceservice.yaml @@ -0,0 +1,20 @@ +apiVersion: serving.kserve.io/v1beta1 +kind: InferenceService +metadata: + name: {{ .Values.inferenceService.name }} + namespace: {{ .Values.inferenceService.namespace }} + 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 }} + 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..2ed7233 --- /dev/null +++ b/charts/kserve/templates/ingress.yaml @@ -0,0 +1,31 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Values.inferenceService.name }} + namespace: {{ .Values.ingress.namespace }} + labels: + {{- include "kserve.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.ingress.annotations | nindent 4 }} +spec: + ingressClassName: {{ .Values.ingress.className }} + rules: + - host: {{ if .Values.ingress.host.wildcard }}*.{{ end }}{{ .Values.ingress.host.domain }} + http: + paths: + - backend: + service: + name: {{ .Values.ingress.backend.service.name }} + port: + number: {{ .Values.ingress.backend.service.port }} + path: / + pathType: Prefix + {{- if .Values.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.ingress.host.domain }} + - {{ if .Values.ingress.host.wildcard }}*.{{ end }}{{ .Values.ingress.host.domain }} + 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..51b7b1a --- /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" + + # 리소스 설정 + 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 + host: + domain: "demo01-test1.hopt.paasup.io" + wildcard: false + backend: + service: + name: istio-ingressgateway + port: 80 + tls: + enabled: true + secretName: kserve-tls + +# 이름 오버라이드 설정 +nameOverride: "" +fullnameOverride: "" \ No newline at end of file