Files
more_dots/deploy/dev/deployment.yaml
T
2026-03-24 18:07:22 +08:00

59 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# apbo-boat-agent/deploy/dev/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: apbo-boat-agent-dev
namespace: apbo-dev # 替换为实际 namespace
spec:
strategy:
type: Recreate # 防止出现之前的服务还没有下掉,端口占用,导致新的服务起不来
replicas: 1
selector:
matchLabels:
app: apbo-boat-agent-dev
template:
metadata:
labels:
app: apbo-boat-agent-dev
spec:
hostNetwork: true # 关键:使用宿主机网络
containers:
- name: apbo-boat-agent
image: 10.122.172.43:9080/apbo-boat-agent:dev-latest # 占位镜像,Jenkins 会覆盖
ports:
- containerPort: 26004
# 由于 hostNetwork,containerPort 直接占用宿主机 8080 端口
env:
- name: SPRING_PROFILES_ACTIVE
value: "dev"
- name: NACOS_SERVER_ADDR
value: "10.122.132.204:8848" # 根据实际 Nacos 地址调整
- name: NACOS_NAMESPACE
value: "apbo_dev"
- name: NACOS_GROUP
value: "apbo"
- name: NACOS_USERNAME
value: "nacos"
- name: NACOS_PASSWORD
value: "bgs20250901"
# 如有其他配置,通过环境变量传递
resources:
requests:
memory: "1Gi"
cpu: "1000m"
limits:
memory: "2Gi"
cpu: "2000m"
---
apiVersion: v1
kind: Service
metadata:
name: apbo-boat-agent-dev
namespace: apbo-dev
spec:
selector:
app: apbo-boat-agent-dev
ports:
- port: 8000
targetPort: 26004
type: ClusterIP # 该 Service 仅用于集群内 DNS 发现,实际访问通过宿主机 IP + 8080