docker
This commit is contained in:
parent
986b8ba632
commit
2e03f31a09
3 changed files with 296 additions and 31 deletions
145
k8s/base/deployment.yaml
Normal file
145
k8s/base/deployment.yaml
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: fastapi-dynamic-response
|
||||
namespace: fastapi-dynamic-response
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: fastapi-dynamic-response
|
||||
namespace: fastapi-dynamic-response
|
||||
spec:
|
||||
ports:
|
||||
- name: "8000"
|
||||
port: 8000
|
||||
targetPort: 8000
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: fastapi-dynamic-response
|
||||
namespace: fastapi-dynamic-response
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fastapi-dynamic-response
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: fastapi-dynamic-response
|
||||
spec:
|
||||
# affinity:
|
||||
# podAntiAffinity:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution:
|
||||
# - labelSelector:
|
||||
# matchLabels:
|
||||
# app: fastapi-dynamic-response
|
||||
# topologyKey: "kubernetes.io/hostname"
|
||||
containers:
|
||||
- image: docker.io/waylonwalker/fastapi-dynamic-response:0.0.2
|
||||
name: fastapi-dynamic-response
|
||||
args: ["./.venv/bin/uvicorn", "src.fastapi_dynamic_response.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
protocol: TCP
|
||||
imagePullPolicy: Always
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /livez
|
||||
port: 8000
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 10
|
||||
failureThreshold: 3
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8000
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 15
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
ephemeral-storage: 1Gi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 500Mi
|
||||
ephemeral-storage: 2Gi
|
||||
restartPolicy: Always
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: fastapi-dynamic-response
|
||||
namespace: fastapi-dynamic-response
|
||||
spec:
|
||||
rules:
|
||||
- host: app.fokais.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
service:
|
||||
name: fastapi-dynamic-response
|
||||
port:
|
||||
number: 8000
|
||||
path: /
|
||||
pathType: Prefix
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: allow-fastapi-dynamic-response
|
||||
namespace: fastapi-dynamic-response
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: fastapi-dynamic-response
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
- from:
|
||||
- podSelector: {}
|
||||
# - namespaceSelector:
|
||||
# matchLabels:
|
||||
# name: fastapi-dynamic-response
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8000
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 0.0.0.0/0
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
---
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: fastapi-dynamic-response-pdb
|
||||
namespace: fastapi-dynamic-response
|
||||
spec:
|
||||
minAvailable: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: fastapi-dynamic-response
|
||||
Loading…
Add table
Add a link
Reference in a new issue