From cee789f31d06884e7cb0565789d8d48425932974 Mon Sep 17 00:00:00 2001 From: JACKYMYPERSON Date: Mon, 15 Sep 2025 22:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0k8s=20deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yaml | 2 +- controllers/kills/kill.go | 2 +- docker/minio/minio-deployment.yml | 47 ++++++++++++++++++++++++ docker/minio/minio-pvc.yml | 10 +++++ docker/minio/minio-service.yaml | 17 +++++++++ docker/{ => rocketmq}/docker-compose.yml | 0 6 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 docker/minio/minio-deployment.yml create mode 100644 docker/minio/minio-pvc.yml create mode 100644 docker/minio/minio-service.yaml rename docker/{ => rocketmq}/docker-compose.yml (100%) diff --git a/config.yaml b/config.yaml index 9475799..603b842 100644 --- a/config.yaml +++ b/config.yaml @@ -7,7 +7,7 @@ database: params: "charset=utf8mb4&parseTime=True&loc=Local" redis: host: "localhost" - port: 6379 + port: 30079 username: "default" password: "" jwtsecret: "clka1af83af15vhyt8s652avre" diff --git a/controllers/kills/kill.go b/controllers/kills/kill.go index 910daea..e037436 100644 --- a/controllers/kills/kill.go +++ b/controllers/kills/kill.go @@ -50,7 +50,7 @@ func Userkill(c *gin.Context) { return } - // 2. 发送MQ消息(关键:发送失败需回滚Redis) + // 2. 发送MQ消息 msgSent := false defer func() { // 若消息未发送成功,回滚Redis库存 diff --git a/docker/minio/minio-deployment.yml b/docker/minio/minio-deployment.yml new file mode 100644 index 0000000..001ed85 --- /dev/null +++ b/docker/minio/minio-deployment.yml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: minio +spec: + selector: + matchLabels: + app: minio + template: + metadata: + labels: + app: minio + spec: + containers: + - name: minio + image: minio/minio:latest + args: + - server + - /storage + env: + - name: MINIO_ROOT_USER + value: "admin" + - name: MINIO_ROOT_PASSWORD + value: "password123" + ports: + - containerPort: 9000 + - containerPort: 9001 + volumeMounts: + - name: storage + mountPath: "/storage" + volumes: + - name: storage + persistentVolumeClaim: + claimName: minio-pvc +--- +apiVersion: v1 +kind: Service +metadata: + name: minio-service +spec: + selector: + app: minio + ports: + - protocol: TCP + port: 9000 + targetPort: 9000 + type: NodePort \ No newline at end of file diff --git a/docker/minio/minio-pvc.yml b/docker/minio/minio-pvc.yml new file mode 100644 index 0000000..ed00e36 --- /dev/null +++ b/docker/minio/minio-pvc.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: minio-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi \ No newline at end of file diff --git a/docker/minio/minio-service.yaml b/docker/minio/minio-service.yaml new file mode 100644 index 0000000..bf0799d --- /dev/null +++ b/docker/minio/minio-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: minio-service +spec: + selector: + app: minio # 确保与 MinIO Pod 标签一致 + ports: + - name: minio-api # 服务端口(用于 API 访问) + port: 9000 + targetPort: 9000 + nodePort: 32690 # 已有的 NodePort + - name: minio-console # 新增控制台端口 + port: 9001 + targetPort: 9001 + nodePort: 32691 # 新增 NodePort(30000-32767 范围内选一个未占用的) + type: NodePort \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/rocketmq/docker-compose.yml similarity index 100% rename from docker/docker-compose.yml rename to docker/rocketmq/docker-compose.yml