personal-lifecycle-tracker / k8s / backend.yaml
backend.yaml
Raw
apiVersion: apps/v1
kind: Deployment
metadata:
  name: lifecycle-backend
  labels:
    app: lifecycle-backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lifecycle-backend
  template:
    metadata:
      labels:
        app: lifecycle-backend
    spec:
      containers:
        - name: backend
          image: personal-lifecycle-backend:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8000
          env:
            - name: DATABASE_URL
              value: postgresql://postgres:postgres@lifecycle-postgres:5432/lifecycle
            - name: APP_ENV
              value: kubernetes
            - name: PYTHONUNBUFFERED
              value: "1"
          readinessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 5
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 10
            periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
  name: lifecycle-backend
  labels:
    app: lifecycle-backend
spec:
  selector:
    app: lifecycle-backend
  ports:
    - port: 8000
      targetPort: 8000