更改
This commit is contained in:
@@ -204,7 +204,6 @@ pipeline {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
failure {
|
||||
|
||||
@@ -204,7 +204,6 @@ pipeline {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
failure {
|
||||
|
||||
@@ -204,7 +204,6 @@ pipeline {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
failure {
|
||||
|
||||
@@ -206,7 +206,6 @@ pipeline {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
failure {
|
||||
|
||||
@@ -6,7 +6,7 @@ pipeline {
|
||||
branchFilter: 'origin/(.*)',
|
||||
defaultValue: 'dxin',
|
||||
name: 'Code_branch',
|
||||
type: 'PT_BRANCH',
|
||||
type: 'PT_BRANCH_TAG',
|
||||
selectedValue: 'DEFAULT',
|
||||
sortMode: 'NONE',
|
||||
description: '选择代码分支: ',
|
||||
@@ -217,7 +217,6 @@ pipeline {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
failure {
|
||||
|
||||
@@ -187,7 +187,6 @@ pipeline {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
failure {
|
||||
|
||||
35
SCM/deploy_image_s1_lessie_go_api.groovy
Normal file
35
SCM/deploy_image_s1_lessie_go_api.groovy
Normal file
@@ -0,0 +1,35 @@
|
||||
pipeline {
|
||||
agent any
|
||||
parameters {
|
||||
imageTag(
|
||||
name: 'IMAGE_NAME',
|
||||
description: '此处是 sit 命名空间内的镜像',
|
||||
registry: 'https://uswccr.ccs.tencentyun.com',
|
||||
image: 'lessiesit/lessie-sourcing-agents',
|
||||
credentialId: 'dxin_img_hub_auth',
|
||||
filter: '.*',
|
||||
verifySsl: true
|
||||
)
|
||||
}
|
||||
environment {
|
||||
// 将 kubeconfig 凭证路径赋值给 KUBECONFIG 环境变量,凭证 ID 与 Jenkins 中配置的一致
|
||||
KUBECONFIG = credentials('k8s-test-config-admin')
|
||||
}
|
||||
stages {
|
||||
stage('部署') {
|
||||
steps {
|
||||
script {
|
||||
// 提取纯标签(去掉附加的Label信息)
|
||||
// def pureTag = params.IMAGE_NAME.split(' ')[0]
|
||||
// echo "开始部署镜像:uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:${pureTag}"
|
||||
// 部署命令(如kubectl、docker run等)
|
||||
sh """
|
||||
kubectl apply -f lessie-sourcing-agents.yaml
|
||||
"""
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
k8s_yaml/s1/Readme.md
Normal file
27
k8s_yaml/s1/Readme.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## Python
|
||||
- 集群内 svc 域名:`http://test-lessie-agents-svc.test-lessie.svc.cluster.local:8000`
|
||||
- 集群外部:`http://<Node_IP>:38000`
|
||||
|
||||
## Go
|
||||
- 集群内部:`http://test-lessie-go-api-svc.test-lessie.svc.cluster.local:8100`
|
||||
- 集群外部:`http://<Node_IP>:30810`
|
||||
|
||||
## Java
|
||||
- **flymoon-agent**
|
||||
- 集群内部:`http://test-flymoon-agent-svc.test-lessie.svc.cluster.local:8070`
|
||||
- 集群外部:`http://<Node_IP>:30807`
|
||||
- **flymoon-admin**
|
||||
- 集群内部:`http://test-flymoon-admin-svc.test-lessie.svc.cluster.local:8080`
|
||||
- 集群外部:`http://<Node_IP>:30808`
|
||||
- **flymoon-payment**
|
||||
- 集群内部:`http://test-flymoon-payment-svc.test-lessie.svc.cluster.local:8090`
|
||||
- 集群外部:`http://<Node_IP>:30809`
|
||||
|
||||
## 主站前端
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
39
k8s_yaml/s1/network-test-pod.yaml
Normal file
39
k8s_yaml/s1/network-test-pod.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: network-test-pod
|
||||
namespace: lessie-sit
|
||||
labels:
|
||||
app: network-test
|
||||
spec:
|
||||
containers:
|
||||
- name: network-tools
|
||||
image: nicolaka/netshoot:latest
|
||||
command: ["/bin/sh"]
|
||||
args: ["-c", "sleep 3600"] # 保持运行1小时
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: network-test-pod-svc
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: network-test
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: network-test
|
||||
ports:
|
||||
- name: http
|
||||
port: 6100 # ClusterIP 内部端口
|
||||
targetPort: 6100 # 容器端口
|
||||
# nodePort: 30610 # 节点对外端口(30000-32767)
|
||||
91
k8s_yaml/s1/s1-flymoon-admin.yaml
Normal file
91
k8s_yaml/s1/s1-flymoon-admin.yaml
Normal file
@@ -0,0 +1,91 @@
|
||||
# ----------------------------
|
||||
# Deployment
|
||||
# ----------------------------
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: s1-flymoon-admin-deployment
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: s1-flymoon-admin
|
||||
environment: s1
|
||||
project: flymoon
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: s1-flymoon-admin
|
||||
environment: s1
|
||||
project: flymoon
|
||||
strategy:
|
||||
type: RollingUpdate # 滚动更新策略
|
||||
rollingUpdate:
|
||||
maxSurge: 1 # 最大新增副本数,更新过程中「超出期望副本数」最多为1(每次只创建1个新 Pod)
|
||||
maxUnavailable: 0 # 最大不可用副本数,更新过程中「不可用 Pod 数」最多为0(不允许服务降级)
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: s1-flymoon-admin
|
||||
environment: s1
|
||||
project: flymoon
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dxin-image-repository # 镜像仓库凭证Secret
|
||||
volumes:
|
||||
- name: flymoon-admin-logs-volume
|
||||
hostPath:
|
||||
path: /data/logs/flymoon-admin/
|
||||
type: DirectoryOrCreate
|
||||
containers:
|
||||
- name: s1-flymoon-admin # 容器名称
|
||||
image: uswccr.ccs.tencentyun.com/lessiesit/flymoon-admin:v0.0.1 # 容器镜像
|
||||
imagePullPolicy: Always # 镜像拉取策略 拉
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: "s1"
|
||||
ports:
|
||||
- containerPort: 8080 # 容器暴露的端口
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m" # 容器请求分配0.1个CPU核心(这不是实际占用,但调度会以这里进行参考)
|
||||
memory: "1Gi" # 容器请求分配1Gi内存(这会实际预留)
|
||||
limits:
|
||||
cpu: "1" # 最多可以使用1个CPU核心
|
||||
memory: "3Gi" # 容器最多可以使用3Gi内存
|
||||
volumeMounts:
|
||||
- name: flymoon-admin-logs-volume
|
||||
mountPath: /app/logs/
|
||||
subPathExpr: flymoon-admin-log-$(POD_NAME)
|
||||
|
||||
---
|
||||
# ----------------------------
|
||||
# Service
|
||||
# 集群内部:http://s1-flymoon-admin-svc.s1-lessie.svc.cluster.local:8080
|
||||
# 集群外部:http://<Node-IP>:30808
|
||||
# ----------------------------
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: s1-flymoon-admin-svc
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: s1-flymoon-admin
|
||||
environment: s1
|
||||
project: flymoon
|
||||
spec:
|
||||
type: NodePort
|
||||
selector: # 必须匹配 Deployment 的 labels 才能关联 Pod
|
||||
app: s1-flymoon-admin
|
||||
environment: s1
|
||||
project: flymoon
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080 # ClusterIP 内部端口
|
||||
targetPort: 8080 # 容器端口
|
||||
nodePort: 30808 # 节点对外端口(30000-32767)
|
||||
|
||||
107
k8s_yaml/s1/s1-lessie-go-api.yaml
Normal file
107
k8s_yaml/s1/s1-lessie-go-api.yaml
Normal file
@@ -0,0 +1,107 @@
|
||||
# ----------------------------
|
||||
# Deployment
|
||||
# ----------------------------
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: s1-lessie-go-api-deployment
|
||||
namespace: sit
|
||||
labels:
|
||||
app: s1-lessie-go-api
|
||||
environment: s1
|
||||
project: lessie
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: s1-lessie-go-api
|
||||
environment: s1
|
||||
project: lessie
|
||||
strategy:
|
||||
type: RollingUpdate # 滚动更新策略
|
||||
rollingUpdate:
|
||||
maxSurge: 1 # 最大新增副本数
|
||||
maxUnavailable: 0 # 最大不可用副本数
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: s1-lessie-go-api
|
||||
environment: s1
|
||||
project: lessie
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dxin-image-repository # 镜像仓库凭证Secret
|
||||
volumes:
|
||||
- name: go-logs-volume
|
||||
hostPath:
|
||||
path: /data/logs/lessie-go-api/
|
||||
type: DirectoryOrCreate
|
||||
containers:
|
||||
- name: s1-lessie-go-api # 容器名称
|
||||
image: uswccr.ccs.tencentyun.com/lessiesit/go_lessie-sourcing-api:v0.0.1 # 容器镜像
|
||||
imagePullPolicy: Always # 镜像拉取策略 ,总是拉
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: APP_ENV
|
||||
value: "s1"
|
||||
- name: APP_PORT
|
||||
value: "8100"
|
||||
ports:
|
||||
- containerPort: 8100 # 容器暴露的端口
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m" # 容器请求分配0.1个CPU核心(这不是实际占用,但调度会以这里进行参考)
|
||||
memory: "1Gi" # 容器请求分配1.5Gi内存(这会实际预留)
|
||||
limits:
|
||||
cpu: "1" # 最多可以使用1个CPU核心
|
||||
memory: "3Gi" # 容器最多可以使用3Gi内存
|
||||
volumeMounts:
|
||||
- name: go-logs-volume
|
||||
mountPath: /app/logs/
|
||||
subPathExpr: go-log-$(POD_NAME)
|
||||
readinessProbe: # 就绪探针,用于判断容器是否已准备好接收流量
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8100
|
||||
initialDelaySeconds: 5 # 就绪探测在容器启动后等待多少秒才开始第一次探测(避免应用启动未完成即被判为不就绪)
|
||||
periodSeconds: 10 # 就绪探测的间隔秒数,每隔多少秒执行一次探测
|
||||
timeoutSeconds: 5 # 单次就绪探测的超时时间(秒),超过则该次探测视为失败
|
||||
failureThreshold: 3 # 连续失败多少次后认为就绪探测失败(Pod 不再被视为就绪)
|
||||
livenessProbe: # 存活探针,用于判断容器是否仍然健康,失败会触发重启
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8100
|
||||
initialDelaySeconds: 10 # 存活探测在容器启动后等待多少秒才开始第一次探测
|
||||
periodSeconds: 30 # 存活探测的间隔秒数
|
||||
timeoutSeconds: 5 # 单次存活探测的超时时间(秒)
|
||||
failureThreshold: 3 # 连续失败多少次后认为容器不健康并触发重启
|
||||
|
||||
---
|
||||
# ----------------------------
|
||||
# Service
|
||||
# 集群内部:http://s1-lessie-go-api-svc.sit.svc.cluster.local:8100
|
||||
# ----------------------------
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: s1-lessie-go-api-svc
|
||||
namespace: sit
|
||||
labels:
|
||||
app: s1-lessie-go-api
|
||||
environment: s1
|
||||
project: lessie
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector: # 必须匹配 Deployment 的 labels 才能关联 Pod
|
||||
app: s1-lessie-go-api
|
||||
environment: s1
|
||||
project: lessie
|
||||
ports:
|
||||
- name: http
|
||||
port: 8100 # ClusterIP 内部端口
|
||||
targetPort: 8100 # 容器端口
|
||||
|
||||
91
k8s_yaml/s1/test-flymoon-agent.yaml
Normal file
91
k8s_yaml/s1/test-flymoon-agent.yaml
Normal file
@@ -0,0 +1,91 @@
|
||||
# ----------------------------
|
||||
# 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 # 容器名称
|
||||
image: uswccr.ccs.tencentyun.com/lessietest/flymoon-agent:v0.0.5 # 容器镜像
|
||||
imagePullPolicy: Always # 镜像拉取策略,拉
|
||||
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)
|
||||
|
||||
90
k8s_yaml/s1/test-flymoon-payment.yaml
Normal file
90
k8s_yaml/s1/test-flymoon-payment.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
# ----------------------------
|
||||
# Deployment
|
||||
# ----------------------------
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-flymoon-payment-deployment
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: test-flymoon-payment
|
||||
environment: test
|
||||
project: flymoon
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-flymoon-payment
|
||||
environment: test
|
||||
project: flymoon
|
||||
strategy:
|
||||
type: RollingUpdate # 滚动更新策略
|
||||
rollingUpdate:
|
||||
maxSurge: 1 # 最大新增副本数
|
||||
maxUnavailable: 0 # 最大不可用副本数
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-flymoon-payment
|
||||
environment: test
|
||||
project: flymoon
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dxin-image-repository # 镜像仓库凭证Secret
|
||||
volumes:
|
||||
- name: flymoon-payment-logs-volume
|
||||
hostPath:
|
||||
path: /data/logs/flymoon-payment/
|
||||
type: DirectoryOrCreate
|
||||
containers:
|
||||
- name: test-flymoon-payment # 容器名称
|
||||
image: uswccr.ccs.tencentyun.com/lessietest/flymoon-payment:v0.0.7 # 容器镜像
|
||||
imagePullPolicy: Always # 镜像拉取策略,总是拉取
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: "s1"
|
||||
ports:
|
||||
- containerPort: 8090 # 容器暴露的端口
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m" # 容器请求分配0.1个CPU核心(这不是实际占用,但调度会以这里进行参考)
|
||||
memory: "1Gi" # 容器请求分配1Gi内存(这会实际预留)
|
||||
limits:
|
||||
cpu: "1" # 最多可以使用1个CPU核心
|
||||
memory: "3Gi" # 容器最多可以使用3Gi内存
|
||||
volumeMounts:
|
||||
- name: flymoon-payment-logs-volume
|
||||
mountPath: /app/logs/
|
||||
subPathExpr: flymoon-payment-log-$(POD_NAME)
|
||||
|
||||
---
|
||||
# ----------------------------
|
||||
# Service
|
||||
# 集群内部:http://test-flymoon-payment-svc.test-lessie.svc.cluster.local:8090
|
||||
# 集群外部:http://<Node-IP>:30809
|
||||
# ----------------------------
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-flymoon-payment-svc
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: test-flymoon-payment
|
||||
environment: test
|
||||
project: flymoon
|
||||
spec:
|
||||
type: NodePort
|
||||
selector: # 必须匹配 Deployment 的 labels 才能关联 Pod
|
||||
app: test-flymoon-payment
|
||||
environment: test
|
||||
project: flymoon
|
||||
ports:
|
||||
- name: http
|
||||
port: 8090 # ClusterIP 内部端口
|
||||
targetPort: 8090 # 容器端口
|
||||
nodePort: 30809 # 节点对外端口(30000-32767)
|
||||
110
k8s_yaml/s1/test-lessie-agents.yaml
Normal file
110
k8s_yaml/s1/test-lessie-agents.yaml
Normal file
@@ -0,0 +1,110 @@
|
||||
# ----------------------------
|
||||
# Deployment
|
||||
# ----------------------------
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-lessie-agents-deployment
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: test-lessie-agents
|
||||
environment: test
|
||||
project: lessie
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-lessie-agents
|
||||
environment: test
|
||||
project: lessie
|
||||
strategy:
|
||||
type: RollingUpdate # 滚动更新策略
|
||||
rollingUpdate:
|
||||
maxSurge: 1 # 最大新增副本数(先加)
|
||||
maxUnavailable: 0 # 最大不可用副本数(不减)
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-lessie-agents
|
||||
environment: test
|
||||
project: lessie
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dxin-image-repository # 镜像仓库凭证Secret
|
||||
volumes:
|
||||
- name: aws-credentials-volume # aws-credentials 卷文件
|
||||
configMap:
|
||||
name: aws-credentials
|
||||
- name: google-credentials-volume
|
||||
configMap:
|
||||
name: google-credentials
|
||||
- name: lessie-logs-volume
|
||||
hostPath:
|
||||
path: /data/logs/lessie-agents/
|
||||
type: DirectoryOrCreate
|
||||
containers:
|
||||
- name: test-lessie-agents # 容器名称
|
||||
image: uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:v0.0.2 # 容器镜像
|
||||
imagePullPolicy: Always # 镜像拉取策略拉
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: APP_ENV
|
||||
value: "s1"
|
||||
- name: APP_PORT
|
||||
value: "8000"
|
||||
- name: GUNICORN_WORKERS
|
||||
value: "2"
|
||||
- name: MAX_REQUESTS
|
||||
value: "200"
|
||||
- name: MAX_REQUESTS_JITTER
|
||||
value: "50"
|
||||
ports:
|
||||
- containerPort: 8000 # 容器暴露的端口
|
||||
resources:
|
||||
requests:
|
||||
cpu: "0.5" # 容器请求分配0.5个CPU核心(这不是实际占用,但调度会以这里进行参考)
|
||||
memory: "2Gi" # 容器请求分配1Gi内存(这会实际预留)
|
||||
limits:
|
||||
cpu: "2" # 最多可以使用2个CPU核心
|
||||
memory: "10Gi" # 容器最多可以使用8Gi内存
|
||||
volumeMounts:
|
||||
- name: aws-credentials-volume
|
||||
mountPath: /root/.aws/
|
||||
- name: google-credentials-volume
|
||||
mountPath: /root/.google/
|
||||
- name: lessie-logs-volume
|
||||
mountPath: /data/webapps/lessie_sourcing_agents/logs/
|
||||
subPathExpr: lessie-agents-$(POD_NAME)
|
||||
|
||||
---
|
||||
# ----------------------------
|
||||
# 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"}'
|
||||
# ----------------------------
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-lessie-agents-svc
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: test-lessie-agents
|
||||
environment: test
|
||||
project: lessie
|
||||
spec:
|
||||
type: NodePort
|
||||
selector: # 必须匹配 Deployment 的 labels 才能关联 Pod
|
||||
app: test-lessie-agents
|
||||
environment: test
|
||||
project: lessie
|
||||
ports:
|
||||
- name: http
|
||||
port: 8000 # ClusterIP 内部端口
|
||||
targetPort: 8000 # 容器端口
|
||||
nodePort: 30800 # 节点对外端口(30000-32767)
|
||||
|
||||
81
k8s_yaml/s1/test-lessie-ai-web.yaml
Normal file
81
k8s_yaml/s1/test-lessie-ai-web.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
# ----------------------------
|
||||
# Deployment
|
||||
# ----------------------------
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test-lessie-ai-web-deployment
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: test-lessie-ai-web
|
||||
environment: test
|
||||
project: lessie
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-lessie-ai-web
|
||||
environment: test
|
||||
project: lessie
|
||||
strategy:
|
||||
type: RollingUpdate # 滚动更新策略
|
||||
rollingUpdate:
|
||||
maxSurge: 1 # 最大新增副本数(先加)
|
||||
maxUnavailable: 0 # 最大不可用副本数(不减)
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-lessie-ai-web
|
||||
environment: test
|
||||
project: lessie
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dxin-image-repository
|
||||
volumes:
|
||||
- name: test-default-conf-volume
|
||||
configMap:
|
||||
name: test-default-conf
|
||||
containers:
|
||||
- name: test-lessie-ai-web
|
||||
image: uswccr.ccs.tencentyun.com/lessiesit/lessie-ai-web:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
resources:
|
||||
requests:
|
||||
cpu: "200m" # 容器请求分配0.2个CPU核心(这不是实际占用,但调度会以这里进行参考)
|
||||
memory: "256Mi" # 容器请求分配1Gi内存(这会实际预留)
|
||||
limits:
|
||||
cpu: "500m" # 最多可以使用0.5个CPU核心
|
||||
memory: "512Mi" # 容器最多可以使用8Gi内存
|
||||
volumeMounts:
|
||||
- name: test-default-conf-volume
|
||||
mountPath: /etc/nginx/conf.d/default.conf
|
||||
subPath: default.conf
|
||||
|
||||
---
|
||||
# ----------------------------
|
||||
# Service
|
||||
# 集群内部:http://test-lessie-ai-web-svc.test-lessie.svc.cluster.local:8000
|
||||
# 集群外部:http://<Node_IP>:30080
|
||||
# ----------------------------
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test-lessie-ai-web-svc
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: test-lessie-ai-web
|
||||
environment: test
|
||||
project: lessie
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: test-lessie-ai-web
|
||||
environment: test
|
||||
project: lessie
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30080
|
||||
89
k8s_yaml/s1/test-lessie-ingress.yaml
Normal file
89
k8s_yaml/s1/test-lessie-ingress.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
ingress.cloud.tencent.com/auto-rewrite: "false"
|
||||
ingress.cloud.tencent.com/client-token: 454eb954-4094-43fc-9cff-05f3f7f307c7
|
||||
ingress.cloud.tencent.com/healthcheck-interval: "5"
|
||||
ingress.cloud.tencent.com/healthcheck-method: GET
|
||||
ingress.cloud.tencent.com/healthcheck-path: /health
|
||||
ingress.cloud.tencent.com/healthcheck-timeout: "3"
|
||||
ingress.cloud.tencent.com/healthy-threshold: "2"
|
||||
ingress.cloud.tencent.com/status.conditions: '[{"type":"Ready","status":"True","lastTransitionTime":"2025-11-05T09:47:06Z","reason":"Success","message":""}]'
|
||||
ingress.cloud.tencent.com/unhealthy-threshold: "3"
|
||||
kubernetes.io/ingress.class: qcloud
|
||||
kubernetes.io/ingress.extensiveParameters: '{"AddressIPVersion":"IPV4","InternetAccessible":{"InternetChargeType":"TRAFFIC_POSTPAID_BY_HOUR","InternetMaxBandwidthOut":100}}'
|
||||
kubernetes.io/ingress.http-rules: "null"
|
||||
kubernetes.io/ingress.https-rules: '[{"host":"test.jennie.im","path":"/","backend":{"serviceName":"test-lessie-ai-web-svc","servicePort":"80"}},{"host":"test.jennie.im","path":"/payment/webhook","backend":{"serviceName":"test-flymoon-payment-svc","servicePort":"8090"}},{"host":"test.jennie.im","path":"/sit-api/agent/","backend":{"serviceName":"test-flymoon-agent-svc","servicePort":"8070"}},{"host":"test.jennie.im","path":"/sit-api/system/","backend":{"serviceName":"test-flymoon-agent-svc","servicePort":"8070"}},{"host":"test.jennie.im","path":"/api/chat","backend":{"serviceName":"test-lessie-go-api-svc","servicePort":"8100"}}]'
|
||||
kubernetes.io/ingress.qcloud-loadbalance-id: lb-ifri829c
|
||||
kubernetes.io/ingress.rule-mix: "true"
|
||||
creationTimestamp: "2025-10-31T06:28:10Z"
|
||||
finalizers:
|
||||
- ingress.k8s.tencent/resources
|
||||
generation: 14
|
||||
labels:
|
||||
ingress.cloud.tencent.com/loadbalance-type: OPEN
|
||||
name: test-lessie-ingress
|
||||
namespace: test-lessie
|
||||
resourceVersion: "2052378552"
|
||||
uid: d196795e-711d-4b08-a5f7-22613becfc13
|
||||
spec:
|
||||
rules:
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-lessie-ai-web-svc
|
||||
port:
|
||||
number: 80
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-flymoon-payment-svc
|
||||
port:
|
||||
number: 8090
|
||||
path: /payment/webhook
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-flymoon-agent-svc
|
||||
port:
|
||||
number: 8070
|
||||
path: /sit-api/agent/
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-flymoon-agent-svc
|
||||
port:
|
||||
number: 8070
|
||||
path: /sit-api/system/
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-lessie-go-api-svc
|
||||
port:
|
||||
number: 8100
|
||||
path: /api/chat
|
||||
pathType: ImplementationSpecific
|
||||
tls:
|
||||
- hosts:
|
||||
- test.jennie.im
|
||||
secretName: jennie-im-sbydostx
|
||||
status:
|
||||
loadBalancer:
|
||||
ingress:
|
||||
- hostname: lb-ifri829c-6dku12mwxpf5ivcs.clb.usw-tencentclb.cloud
|
||||
@@ -18,3 +18,22 @@ spec:
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: network-test-pod-svc
|
||||
namespace: test-lessie
|
||||
labels:
|
||||
app: network-test
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: network-test
|
||||
ports:
|
||||
- name: http
|
||||
port: 6100 # ClusterIP 内部端口
|
||||
targetPort: 6100 # 容器端口
|
||||
# nodePort: 30610 # 节点对外端口(30000-32767)
|
||||
@@ -38,7 +38,7 @@ spec:
|
||||
type: DirectoryOrCreate
|
||||
containers:
|
||||
- name: test-lessie-go-api # 容器名称
|
||||
image: uswccr.ccs.tencentyun.com/lessietest/go_lessie-sourcing-api:v0.0.2 # 容器镜像
|
||||
image: uswccr.ccs.tencentyun.com/lessietest/go_lessie-sourcing-api:v10_dxin_7f126d1_202511061217 # 容器镜像
|
||||
imagePullPolicy: Always # 镜像拉取策略 ,总是拉
|
||||
env:
|
||||
- name: POD_NAME
|
||||
|
||||
89
k8s_yaml/test/test-lessie-ingress.yaml
Normal file
89
k8s_yaml/test/test-lessie-ingress.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
ingress.cloud.tencent.com/auto-rewrite: "false"
|
||||
ingress.cloud.tencent.com/client-token: 454eb954-4094-43fc-9cff-05f3f7f307c7
|
||||
ingress.cloud.tencent.com/healthcheck-interval: "5"
|
||||
ingress.cloud.tencent.com/healthcheck-method: GET
|
||||
ingress.cloud.tencent.com/healthcheck-path: /health
|
||||
ingress.cloud.tencent.com/healthcheck-timeout: "3"
|
||||
ingress.cloud.tencent.com/healthy-threshold: "2"
|
||||
ingress.cloud.tencent.com/status.conditions: '[{"type":"Ready","status":"True","lastTransitionTime":"2025-11-05T09:47:06Z","reason":"Success","message":""}]'
|
||||
ingress.cloud.tencent.com/unhealthy-threshold: "3"
|
||||
kubernetes.io/ingress.class: qcloud
|
||||
kubernetes.io/ingress.extensiveParameters: '{"AddressIPVersion":"IPV4","InternetAccessible":{"InternetChargeType":"TRAFFIC_POSTPAID_BY_HOUR","InternetMaxBandwidthOut":100}}'
|
||||
kubernetes.io/ingress.http-rules: "null"
|
||||
kubernetes.io/ingress.https-rules: '[{"host":"test.jennie.im","path":"/","backend":{"serviceName":"test-lessie-ai-web-svc","servicePort":"80"}},{"host":"test.jennie.im","path":"/payment/webhook","backend":{"serviceName":"test-flymoon-payment-svc","servicePort":"8090"}},{"host":"test.jennie.im","path":"/sit-api/agent/","backend":{"serviceName":"test-flymoon-agent-svc","servicePort":"8070"}},{"host":"test.jennie.im","path":"/sit-api/system/","backend":{"serviceName":"test-flymoon-agent-svc","servicePort":"8070"}},{"host":"test.jennie.im","path":"/api/chat","backend":{"serviceName":"test-lessie-go-api-svc","servicePort":"8100"}}]'
|
||||
kubernetes.io/ingress.qcloud-loadbalance-id: lb-ifri829c
|
||||
kubernetes.io/ingress.rule-mix: "true"
|
||||
creationTimestamp: "2025-10-31T06:28:10Z"
|
||||
finalizers:
|
||||
- ingress.k8s.tencent/resources
|
||||
generation: 14
|
||||
labels:
|
||||
ingress.cloud.tencent.com/loadbalance-type: OPEN
|
||||
name: test-lessie-ingress
|
||||
namespace: test-lessie
|
||||
resourceVersion: "2052378552"
|
||||
uid: d196795e-711d-4b08-a5f7-22613becfc13
|
||||
spec:
|
||||
rules:
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-lessie-ai-web-svc
|
||||
port:
|
||||
number: 80
|
||||
path: /
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-flymoon-payment-svc
|
||||
port:
|
||||
number: 8090
|
||||
path: /payment/webhook
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-flymoon-agent-svc
|
||||
port:
|
||||
number: 8070
|
||||
path: /sit-api/agent/
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-flymoon-agent-svc
|
||||
port:
|
||||
number: 8070
|
||||
path: /sit-api/system/
|
||||
pathType: ImplementationSpecific
|
||||
- host: test.jennie.im
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: test-lessie-go-api-svc
|
||||
port:
|
||||
number: 8100
|
||||
path: /api/chat
|
||||
pathType: ImplementationSpecific
|
||||
tls:
|
||||
- hosts:
|
||||
- test.jennie.im
|
||||
secretName: jennie-im-sbydostx
|
||||
status:
|
||||
loadBalancer:
|
||||
ingress:
|
||||
- hostname: lb-ifri829c-6dku12mwxpf5ivcs.clb.usw-tencentclb.cloud
|
||||
Reference in New Issue
Block a user