2025-10-30 11:20:06 +08:00
|
|
|
|
# ----------------------------
|
|
|
|
|
|
# Deployment
|
|
|
|
|
|
# ----------------------------
|
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
|
|
kind: Deployment
|
|
|
|
|
|
metadata:
|
|
|
|
|
|
name: test-flymoon-agent-deployment
|
|
|
|
|
|
namespace: test-lessie
|
|
|
|
|
|
labels:
|
|
|
|
|
|
app: test-flymoon-agent
|
|
|
|
|
|
environment: test
|
|
|
|
|
|
project: flymoon
|
|
|
|
|
|
spec:
|
|
|
|
|
|
replicas: 1
|
|
|
|
|
|
selector:
|
|
|
|
|
|
matchLabels:
|
|
|
|
|
|
app: test-flymoon-agent
|
|
|
|
|
|
environment: test
|
|
|
|
|
|
project: flymoon
|
|
|
|
|
|
strategy:
|
|
|
|
|
|
type: RollingUpdate # 滚动更新策略
|
|
|
|
|
|
rollingUpdate:
|
|
|
|
|
|
maxSurge: 1 # 最大新增副本数
|
|
|
|
|
|
maxUnavailable: 0 # 最大不可用副本数
|
|
|
|
|
|
template:
|
|
|
|
|
|
metadata:
|
|
|
|
|
|
labels:
|
|
|
|
|
|
app: test-flymoon-agent
|
|
|
|
|
|
environment: test
|
|
|
|
|
|
project: flymoon
|
|
|
|
|
|
spec:
|
|
|
|
|
|
imagePullSecrets:
|
|
|
|
|
|
- name: dxin-image-repository # 镜像仓库凭证Secret
|
|
|
|
|
|
volumes:
|
|
|
|
|
|
- name: flymoon-agent-logs-volume
|
|
|
|
|
|
hostPath:
|
|
|
|
|
|
path: /data/logs/flymoon-agent/
|
|
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
|
|
containers:
|
|
|
|
|
|
- name: test-flymoon-agent # 容器名称
|
2025-11-01 14:50:29 +08:00
|
|
|
|
image: uswccr.ccs.tencentyun.com/lessietest/flymoon-agent:v0.0.5 # 容器镜像
|
|
|
|
|
|
imagePullPolicy: Always # 镜像拉取策略 ,有则不拉
|
2025-10-30 11:20:06 +08:00
|
|
|
|
env:
|
|
|
|
|
|
- name: POD_NAME
|
|
|
|
|
|
valueFrom:
|
|
|
|
|
|
fieldRef:
|
|
|
|
|
|
fieldPath: metadata.name
|
|
|
|
|
|
- name: SPRING_PROFILES_ACTIVE
|
|
|
|
|
|
value: "s1"
|
|
|
|
|
|
ports:
|
|
|
|
|
|
- containerPort: 8070 # 容器暴露的端口
|
|
|
|
|
|
resources:
|
|
|
|
|
|
requests:
|
|
|
|
|
|
cpu: "100m" # 容器请求分配0.1个CPU核心(这不是实际占用,但调度会以这里进行参考)
|
|
|
|
|
|
memory: "1Gi" # 容器请求分配1Gi内存(这会实际预留)
|
|
|
|
|
|
limits:
|
|
|
|
|
|
cpu: "1" # 最多可以使用1个CPU核心
|
|
|
|
|
|
memory: "3Gi" # 容器最多可以使用3Gi内存
|
|
|
|
|
|
volumeMounts:
|
|
|
|
|
|
- name: flymoon-agent-logs-volume
|
|
|
|
|
|
mountPath: /app/logs/
|
|
|
|
|
|
subPathExpr: flymoon-agent-log-$(POD_NAME)
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
# ----------------------------
|
|
|
|
|
|
# Service
|
|
|
|
|
|
# 集群内部:http://test-flymoon-agent-svc.test-lessie.svc.cluster.local:8070
|
|
|
|
|
|
# 集群外部:http://<Node-IP>:30807
|
|
|
|
|
|
# ----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
apiVersion: v1
|
|
|
|
|
|
kind: Service
|
|
|
|
|
|
metadata:
|
|
|
|
|
|
name: test-flymoon-agent-svc
|
|
|
|
|
|
namespace: test-lessie
|
|
|
|
|
|
labels:
|
|
|
|
|
|
app: test-flymoon-agent
|
|
|
|
|
|
environment: test
|
|
|
|
|
|
project: flymoon
|
|
|
|
|
|
spec:
|
|
|
|
|
|
type: NodePort
|
|
|
|
|
|
selector: # 必须匹配 Deployment 的 labels 才能关联 Pod
|
|
|
|
|
|
app: test-flymoon-agent
|
|
|
|
|
|
environment: test
|
|
|
|
|
|
project: flymoon
|
|
|
|
|
|
ports:
|
|
|
|
|
|
- name: http
|
|
|
|
|
|
port: 8070 # ClusterIP 内部端口
|
|
|
|
|
|
targetPort: 8070 # 容器端口
|
|
|
|
|
|
nodePort: 30807 # 节点对外端口(30000-32767)
|
|
|
|
|
|
|