Files

121 lines
2.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: objectstory-rpc
namespace: juwan
labels:
app: objectstory-rpc
spec:
replicas: 3
revisionHistoryLimit: 5
selector:
matchLabels:
app: objectstory-rpc
template:
metadata:
labels:
app: objectstory-rpc
spec:
serviceAccountName: find-endpoints
containers:
- name: objectstory-rpc
image: 103.236.53.208:4418/juwan/objectstory-rpc:latest
ports:
- containerPort: 8080
- containerPort: 4001 # 暴露端口
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 1000m
memory: 1024Mi
volumeMounts:
- name: timezone
mountPath: /etc/localtime
volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
---
apiVersion: v1
kind: Service
metadata:
name: objectstory-rpc-svc
namespace: juwan
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "4001"
prometheus.io/path: "/metrics"
spec:
ports:
- name: metrics
port: 4001
targetPort: 4001
- name: rpc
port: 8080
targetPort: 8080
selector:
app: objectstory-rpc
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: objectstory-rpc-hpa-c
namespace: juwan
labels:
app: objectstory-rpc-hpa-c
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: objectstory-rpc
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: objectstory-rpc-hpa-m
namespace: juwan
labels:
app: objectstory-rpc-hpa-m
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: objectstory-rpc
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80