erp-java/services/invoice-service/deploy/k8s/deployment.yaml

129 lines
2.9 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: invoice-service
namespace: erp
labels:
app: invoice-service
version: v1
spec:
replicas: 2
selector:
matchLabels:
app: invoice-service
template:
metadata:
labels:
app: invoice-service
version: v1
spec:
containers:
- name: invoice-service
image: erp/invoice-service:1.0.0
ports:
- containerPort: 8086
name: http
env:
- name: SPRING_PROFILES_ACTIVE
value: "prod"
- name: DB_HOST
value: "111.229.80.149"
- name: DB_PORT
value: "3306"
- name: DB_NAME
value: "erp_db"
- name: DB_USER
value: "root"
- name: DB_PASSWORD
value: "nihao588+"
- name: REDIS_HOST
value: "111.229.80.149"
- name: REDIS_PORT
value: "6379"
- name: REDIS_PASSWORD
value: "Y(@r5tGk9$Lp2"
- name: NACOS_SERVER
value: "43.226.44.101:8848"
- name: NACOS_NAMESPACE
value: "public"
- name: ROCKETMQ_NAMESRV
value: "43.226.44.101:9876"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /actuator/health
port: 8086
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet:
path: /actuator/health
port: 8086
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
volumeMounts:
- name: invoice-logs
mountPath: /app/logs
- name: invoice-files
mountPath: /app/files
volumes:
- name: invoice-logs
emptyDir: {}
- name: invoice-files
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: invoice-service
namespace: erp
labels:
app: invoice-service
spec:
type: ClusterIP
ports:
- port: 8086
targetPort: 8086
protocol: TCP
name: http
selector:
app: invoice-service
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: invoice-service-hpa
namespace: erp
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: invoice-service
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80