Files
fastapi-demo/k8s/deployment.yaml
2026-05-01 09:29:08 +08:00

54 lines
934 B
YAML

apiVersion: v1
kind: Namespace
metadata:
name: fastapi-demo
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fastapi-app
namespace: fastapi-demo
spec:
replicas: 2
selector:
matchLabels:
app: fastapi-app
template:
metadata:
labels:
app: fastapi-app
spec:
containers:
- name: app
image: registry.plfai.cn/fastapi-demo:latest
ports:
- containerPort: 8000
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 256Mi
---
apiVersion: v1
kind: Service
metadata:
name: fastapi-app
namespace: fastapi-demo
spec:
type: ClusterIP
selector:
app: fastapi-app
ports:
- port: 80
targetPort: 8000