k3s部署项目

This commit is contained in:
2026-04-16 09:26:00 +08:00
parent ac9ec66890
commit 2d844645a0
10 changed files with 350 additions and 62 deletions

51
k8s/configmap.yaml Normal file
View File

@@ -0,0 +1,51 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: report-engine-config
namespace: default
data:
config.yml: |
server:
address : ":3001"
name: "report-engine"
workerId: 1
logPath: "resource/log/server"
logStdout: true
errorStack: true
rate:
limit: 200
burst: 300
database:
default:
- type: "pgsql"
host: "localhost"
port: "5432"
user: "postgres"
pass: "root"
name: "cid"
role: "master"
maxIdle: "5"
maxOpen: "20"
maxLifetime: "60s"
charset: "utf8mb4"
debug: true
dryRun: false
createdAt: "created_at"
updatedAt: "updated_at"
deletedAt: "deleted_at"
timeMaintainDisabled: false
redis:
default:
address: 192.168.3.30:6379
db: 0
idleTimeout: "60s"
maxConnLifetime: "90s"
waitTimeout: "60s"
dialTimeout: "30s"
readTimeout: "30s"
writeTimeout: "30s"
maxActive: 100
consul:
address: ""
jaeger:
addr: ""

60
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: data-engine
namespace: default
labels:
app: data-engine
spec:
replicas: 1
selector:
matchLabels:
app: data-engine
template:
metadata:
labels:
app: data-engine
spec:
containers:
- name: data-engine
image: data-engine:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3001
protocol: TCP
name: http
env:
- name: TZ
value: "Asia/Seoul"
volumeMounts:
- name: config-volume
mountPath: /usr/local/bin/app/config.yml
subPath: config.yml
- name: log-volume
mountPath: /usr/local/bin/app/resource/log
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "1Gi"
cpu: "1000m"
livenessProbe:
tcpSocket:
port: 3001
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
tcpSocket:
port: 3001
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
volumes:
- name: config-volume
configMap:
name: report-engine-config
- name: log-volume
emptyDir: {}
restartPolicy: Always

12
k8s/pvc.yaml Normal file
View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-engine-log-pvc
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: local-path

17
k8s/service.yaml Normal file
View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: data-engine-service
namespace: default
labels:
app: data-engine
spec:
type: NodePort
selector:
app: data-engine
ports:
- name: http
port: 3001
targetPort: 3001
nodePort: 30301
protocol: TCP