91 lines
2.7 KiB
YAML
91 lines
2.7 KiB
YAML
|
|
# ----------------------------
|
|||
|
|
# 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)
|