K8s部署发布自己的Golang应用程序(无坑完整版)
apiVersion: apps/v1
kind: Deployment
metadata:
name: alertgo
namespace: k8s-go
spec:
selector:
matchLabels:
app: alertgo
replicas: 2
template:
metadata:
labels:
app: alertgo
spec:
imagePullSecrets:
- name: registry-pull-secret
containers:
- name: alertgo
image: 10.206.16.4/k8s-go/alert.sentsss.com:v2
ports:
- containerPort: 8088
livenessProbe:
httpGet:
path: /
port: 8088
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 1
readinessProbe:
httpGet:
path: /
port: 8088
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 1
lifecycle:
preStop:
exec:
command: ["/bin/bash","-c","sleep 20"]
resources:
limits:
cpu: 20m
memory: 20Mi
requests:
cpu: 10m
memory: 10Mi