chore: 增加健康检测功能
This commit is contained in:
@@ -14,11 +14,12 @@ RUN go build -ldflags "-X main.build=${BUILD_REF}"
|
||||
|
||||
# todo 设置时区
|
||||
# Run the Go Binary in Alpine
|
||||
FROM alpine:3.14
|
||||
FROM alpine:3.15
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_REF
|
||||
RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.14/main' > /etc/apk/repositories && \
|
||||
echo 'http://mirrors.ustc.edu.cn/alpine/v3.14/community' >>/etc/apk/repositories && \
|
||||
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
||||
RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.15/main' > /etc/apk/repositories && \
|
||||
echo 'http://mirrors.ustc.edu.cn/alpine/v3.15/community' >>/etc/apk/repositories && \
|
||||
apk update && apk add -U tzdata && \
|
||||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo "Asia/Shanghai" > /etc/timezone && \
|
||||
|
||||
@@ -23,4 +23,61 @@ spec:
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: sales-api
|
||||
image: sales-api-image
|
||||
image: sales-api-image
|
||||
ports:
|
||||
- name: sales-api
|
||||
containerPort: 3000
|
||||
- name: saler-api-debug
|
||||
containerPort: 4000
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /debug/readiness
|
||||
port: 4000
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 2
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /debug/liveliness
|
||||
port: 4000
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 2
|
||||
env:
|
||||
- name: KUBERNETES_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: KUBERNETES_PODNAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: KUBERNETES_NAMESPACE_POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
- name: KUBERNETES_NODENAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sales-service
|
||||
namespace: sales-system
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: sales
|
||||
ports:
|
||||
- name: sales-api
|
||||
port: 3000
|
||||
targetPort: sales-api
|
||||
- name: sales-api-debug
|
||||
port: 4000
|
||||
targetPort: sales-api-debug
|
||||
@@ -1,2 +1,9 @@
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
extraPortMappings:
|
||||
- containerPort: 3000
|
||||
hostPort: 3000
|
||||
- containerPort: 4000
|
||||
hostPort: 4000
|
||||
@@ -7,4 +7,4 @@ patchesStrategicMerge:
|
||||
images:
|
||||
- name: sales-api-image
|
||||
newName: sales-api-amd64
|
||||
newTag: "1.1"
|
||||
newTag: "1.2"
|
||||
|
||||
Reference in New Issue
Block a user