Add Kubernetes Helm deployment pipeline
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2026-06-20 02:00:45 +08:00
parent ed1657167d
commit b6dbcefa0f
5 changed files with 79 additions and 7 deletions

6
chart/Chart.yaml Normal file
View File

@@ -0,0 +1,6 @@
apiVersion: v2
name: backend
description: Backend teaching chart
type: application
version: 0.1.0
appVersion: "0.1.0"

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: backend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
resources:
{{- toYaml .Values.resources | nindent 12 }}

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
type: {{ .Values.service.type }}
selector:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
ports:
- name: http
port: {{ .Values.service.port }}
targetPort: 8080
nodePort: {{ .Values.service.nodePort }}

19
chart/values.yaml Normal file
View File

@@ -0,0 +1,19 @@
replicaCount: 1
image:
repository: cdchen-backend
tag: latest
pullPolicy: IfNotPresent
service:
type: NodePort
port: 8080
nodePort: 30089
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 600m
memory: 512Mi