k8s资源配置清单模版
常用配置
kind: Service
apiVersion: v1
metadata:
name: fastapiapp
labels:
app: fastapi
spec:
selector:
app: fastapi
ports:
- protocol: TCP
port: 80
targetPort: 7500
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fastapiapp
labels:
app: fastapi
spec:
replicas: 8
selector:
matchLabels:
app: fastapi
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: fastapi
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "fastapiapp"
dapr.io/app-port: "7500"
spec:
containers:
- name: fastapi
image: lishichao1181/dapr_demo:v1.0.4
ports:
- containerPort: 7500
imagePullPolicy: Always
readinessProbe:
httpGet:
path: healthz
port: 7500
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds : 5
failureThreshold : 3
env:
- name: TZ
value: "Asia/Shanghai"