diff --git a/kubernetes.yaml b/kubernetes.yaml new file mode 100644 index 0000000..e3edadc --- /dev/null +++ b/kubernetes.yaml @@ -0,0 +1,129 @@ +# FlaskPaste Kubernetes Deployment +# Generated from Podman container configuration +# +# Apply: kubectl apply -f kubernetes.yaml +# Delete: kubectl delete -f kubernetes.yaml +--- +apiVersion: v1 +kind: Namespace +metadata: + name: flaskpaste +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: flaskpaste-config + namespace: flaskpaste +data: + FLASK_ENV: "production" + FLASKPASTE_URL_PREFIX: "/paste" + FLASKPASTE_EXPIRY_ANON: "432000" + FLASKPASTE_MAX_ANON: "3145728" + FLASKPASTE_MAX_AUTH: "52428800" +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: flaskpaste-data + namespace: flaskpaste +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: flaskpaste + namespace: flaskpaste + labels: + app: flaskpaste +spec: + replicas: 1 + selector: + matchLabels: + app: flaskpaste + template: + metadata: + labels: + app: flaskpaste + spec: + securityContext: + runAsUser: 999 + runAsGroup: 999 + fsGroup: 999 + containers: + - name: flaskpaste + image: localhost/flaskpaste:latest + ports: + - containerPort: 5000 + protocol: TCP + envFrom: + - configMapRef: + name: flaskpaste-config + volumeMounts: + - name: data + mountPath: /app/data + resources: + limits: + memory: "256Mi" + cpu: "1000m" + requests: + memory: "64Mi" + cpu: "250m" + livenessProbe: + httpGet: + path: /health + port: 5000 + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /health + port: 5000 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 3 + volumes: + - name: data + persistentVolumeClaim: + claimName: flaskpaste-data +--- +apiVersion: v1 +kind: Service +metadata: + name: flaskpaste + namespace: flaskpaste +spec: + selector: + app: flaskpaste + ports: + - protocol: TCP + port: 80 + targetPort: 5000 + type: ClusterIP +--- +# Optional: Ingress for external access +# Uncomment and adjust for your ingress controller +# apiVersion: networking.k8s.io/v1 +# kind: Ingress +# metadata: +# name: flaskpaste +# namespace: flaskpaste +# annotations: +# nginx.ingress.kubernetes.io/proxy-body-size: "50m" +# spec: +# rules: +# - host: paste.example.com +# http: +# paths: +# - path: / +# pathType: Prefix +# backend: +# service: +# name: flaskpaste +# port: +# number: 80