This commit is contained in:
ychangkim
2025-07-09 14:14:38 +09:00
parent ef8cf5771c
commit 2003279869
11 changed files with 300 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
NVIDIA NIMService "{{ .Values.nimService.name }}" has been deployed!
{{- if eq .Values.existingImagePullSecret "" }}
NOTE: Image pull secrets have been created. Make sure to set the correct password in values.yaml or using --set imagePullSecrets[0].password=YOUR_PASSWORD
{{- end }}
{{- if eq .Values.nimService.existingAuthSecret "" }}
NOTE: NGC API authentication secret has been created. Make sure to set the correct NGC API key in values.yaml or using --set nimService.ngcAPIKey=YOUR_NGC_API_KEY
{{- end }}
1. Check the status of the NIMService:
kubectl get nimservice -n {{ .Release.Namespace }} {{ .Values.nimService.name }}
2. Access the NIMService API:
kubectl port-forward -n {{ .Release.Namespace }} service/{{ .Values.nimService.name }} {{ .Values.nimService.expose.service.port }}:{{ .Values.nimService.expose.service.port }}
3. Example API request:
curl -X POST http://localhost:{{ .Values.nimService.expose.service.port }}/v1/completions \
-H "Content-Type: application/json" \
-d '{
"model": "{{ .Values.nimService.name }}",
"prompt": "Hello, how are you?",
"max_tokens": 100
}'
For more information on using NVIDIA NIMService, visit:
https://docs.nvidia.com/nim/
+52
View File
@@ -0,0 +1,52 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "nim.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 "nim.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 "nim.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "nim.labels" -}}
helm.sh/chart: {{ include "nim.chart" . }}
{{ include "nim.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "nim.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nim.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
+12
View File
@@ -0,0 +1,12 @@
{{- if eq .Values.nimService.existingAuthSecret "" }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.nimService.authSecret }}
labels:
{{- include "nim.labels" . | nindent 4 }}
type: Opaque
data:
NGC_API_KEY: {{ .Values.nimService.ngcAPIKey | b64enc }}
{{- end }}
@@ -0,0 +1,14 @@
{{- if eq .Values.existingImagePullSecret "" }}
{{- range .Values.imagePullSecrets }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .name }}
labels:
{{- include "nim.labels" $ | nindent 4 }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password (printf "%s:%s" .username .password | b64enc) | b64enc | quote }}
{{- end }}
{{- end }}
+32
View File
@@ -0,0 +1,32 @@
apiVersion: apps.nvidia.com/v1alpha1
kind: NIMService
metadata:
name: {{ .Values.nimService.name }}
labels:
{{- include "nim.labels" . | nindent 4 }}
spec:
labels:
{{- toYaml .Values.nimService.labels | nindent 4 }}
image:
repository: {{ .Values.image.repository }}
tag: {{ .Values.image.tag | default .Chart.AppVersion }}
pullPolicy: {{ .Values.image.pullPolicy }}
pullSecrets:
{{- range .Values.imagePullSecrets }}
- {{ .name }}
{{- end }}
authSecret: {{ if ne .Values.nimService.existingAuthSecret "" }}{{ .Values.nimService.existingAuthSecret }}{{ else }}{{ .Values.nimService.authSecret }}{{ end }}
replicas: {{ .Values.nimService.replicas }}
storage:
pvc:
create: {{ .Values.nimService.storage.pvc.create }}
storageClass: {{ .Values.nimService.storage.pvc.storageClass }}
size: {{ .Values.nimService.storage.pvc.size }}
volumeAccessMode: {{ .Values.nimService.storage.pvc.volumeAccessMode }}
runtimeClassName: {{ .Values.nimService.runtimeClassName }}
resources:
{{- toYaml .Values.nimService.resources | nindent 4 }}
expose:
service:
type: {{ .Values.nimService.expose.service.type }}
port: {{ .Values.nimService.expose.service.port }}
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Values.nimService.name }}-test-connection"
labels:
{{- include "nim.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ .Values.nimService.name }}:{{ .Values.nimService.expose.service.port }}']
restartPolicy: Never