This commit is contained in:
dxin
2025-11-07 18:06:59 +08:00
parent 1f6cf2a78a
commit 53090845cd
4 changed files with 590 additions and 23 deletions

View File

@@ -4,18 +4,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-lessie-agents-deployment
namespace: test-lessie
name: s1-lessie-agents-deployment
namespace: sit
labels:
app: test-lessie-agents
environment: test
app: s1-lessie-agents
environment: s1
project: lessie
spec:
replicas: 1
selector:
matchLabels:
app: test-lessie-agents
environment: test
app: s1-lessie-agents
environment: s1
project: lessie
strategy:
type: RollingUpdate # 滚动更新策略
@@ -25,8 +25,8 @@ spec:
template:
metadata:
labels:
app: test-lessie-agents
environment: test
app: s1-lessie-agents
environment: s1
project: lessie
spec:
imagePullSecrets:
@@ -43,8 +43,8 @@ spec:
path: /data/logs/lessie-agents/
type: DirectoryOrCreate
containers:
- name: test-lessie-agents # 容器名称
image: uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:v0.0.2 # 容器镜像
- name: s1-lessie-agents # 容器名称
image: uswccr.ccs.tencentyun.com/lessiesit/lessie-sourcing-agents:v0.0.2 # 容器镜像
imagePullPolicy: Always # 镜像拉取策略拉
env:
- name: POD_NAME
@@ -69,7 +69,7 @@ spec:
memory: "2Gi" # 容器请求分配1Gi内存这会实际预留
limits:
cpu: "2" # 最多可以使用2个CPU核心
memory: "10Gi" # 容器最多可以使用8Gi内存
memory: "10Gi" # 容器最多可以使用10Gi内存
volumeMounts:
- name: aws-credentials-volume
mountPath: /root/.aws/
@@ -78,33 +78,48 @@ spec:
- name: lessie-logs-volume
mountPath: /data/webapps/lessie_sourcing_agents/logs/
subPathExpr: lessie-agents-$(POD_NAME)
readinessProbe: # 就绪探针,用于判断容器是否已准备好接收流量
httpGet:
path: /health
port: 8000
initialDelaySeconds: 20 # 就绪探测在容器启动后等待多少秒才开始第一次探测(避免应用启动未完成即被判为不就绪)
periodSeconds: 10 # 就绪探测的间隔秒数,每隔多少秒执行一次探测
timeoutSeconds: 5 # 单次就绪探测的超时时间(秒),超过则该次探测视为失败
failureThreshold: 3 # 连续失败多少次后认为就绪探测失败Pod 不再被视为就绪)
livenessProbe: # 存活探针,用于判断容器是否仍然健康,失败会触发重启
httpGet:
path: /health
port: 8000
initialDelaySeconds: 10 # 存活探测在容器启动后等待多少秒才开始第一次探测
periodSeconds: 30 # 存活探测的间隔秒数
timeoutSeconds: 5 # 单次存活探测的超时时间(秒)
failureThreshold: 3 # 连续失败多少次后认为容器不健康并触发重启
---
# ----------------------------
# Service
# 集群内部http://test-lessie-agents-svc.test-lessie.svc.cluster.local:8000
# 集群外部http://<Node_IP>:38000
# curl -v -X POST http://43.153.12.208:30800/api/chat/stream -H "Content-Type: application/json" -d '{"message": "hello"}'
# 集群内部http://s1-lessie-agents-svc.sit.svc.cluster.local:8000
# curl -v -X POST http://xxxxxxx:8000/api/chat/stream -H "Content-Type: application/json" -d '{"message": "hello"}'
# ----------------------------
apiVersion: v1
kind: Service
metadata:
name: test-lessie-agents-svc
namespace: test-lessie
name: s1-lessie-agents-svc
namespace: sit
labels:
app: test-lessie-agents
environment: test
app: s1-lessie-agents
environment: s1
project: lessie
spec:
type: NodePort
type: ClusterIP
selector: # 必须匹配 Deployment 的 labels 才能关联 Pod
app: test-lessie-agents
environment: test
app: s1-lessie-agents
environment: s1
project: lessie
ports:
- name: http
port: 8000 # ClusterIP 内部端口
targetPort: 8000 # 容器端口
nodePort: 30800 # 节点对外端口(30000-32767)

View File

@@ -38,7 +38,7 @@ spec:
type: DirectoryOrCreate
containers:
- name: s1-lessie-go-api # 容器名称
image: uswccr.ccs.tencentyun.com/lessiesit/go_lessie-sourcing-api:v0.0.1 # 容器镜像
image: uswccr.ccs.tencentyun.com/lessiesit/go_lessie-sourcing-api:v13_dxin_d96a403_202511071407 # 容器镜像
imagePullPolicy: Always # 镜像拉取策略 ,总是拉
env:
- name: POD_NAME