This commit is contained in:
2025-10-25 08:43:42 +08:00
parent e5cd2700aa
commit d207146423
10 changed files with 687 additions and 10 deletions

View File

@@ -0,0 +1,94 @@
# Kubernetes Deployment Configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog
namespace: ${KUBERNETES_NAMESPACE}
labels:
app: blog
spec:
replicas: ${KUBERNETES_DEPLOYMENT_REPLICAS}
selector:
matchLabels:
app: blog
template:
metadata:
labels:
app: blog
spec:
imagePullSecrets:
- name: regcred
containers:
- name: blog
image: ${CONTAINER_REGISTRY_URL}/${CONTAINER_REGISTRY_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_TAG}
imagePullPolicy: Always
ports:
- name: http
containerPort: 8888
protocol: TCP
readinessProbe:
httpGet:
path: /api/blog/ping
port: http
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet:
path: /api/blog/ping
port: http
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 3
resources:
requests:
memory: "128Mi"
cpu: "200m"
limits:
memory: "512Mi"
cpu: "1000m"
env:
- name: TZ
value: "UTC"
- name: DATABASE_DSN
valueFrom:
secretKeyRef:
name: blog-secrets
key: database-dsn
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: blog-secrets
key: jwt-secret
- name: JWT_ISSUER
value: "${JWT_ISSUER}"
- name: JWT_EXPIRES_IN
value: "${JWT_EXPIRES_IN}"
- name: S3_REGION
value: "${S3_REGION}"
- name: S3_BUCKET
value: "${S3_BUCKET}"
- name: S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: blog-secrets
key: s3-access-key-id
- name: S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: blog-secrets
key: s3-secret-access-key
- name: S3_ENDPOINT
value: "${S3_ENDPOINT}"
- name: S3_PRESIGNED_URL_EXPIRATION
value: "${S3_PRESIGNED_URL_EXPIRATION}"