apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-service
  labels:
    app: hello
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello
  template:
    metadata:
      labels:
        app: hello
    spec:
      volumes:
        - name: hello-service-volume
          persistentVolumeClaim:
            claimName: hello-service-dynamic-pvc
      containers:
        - name: hello
          imagePullPolicy: Never
          image: service:3
          ports:
            - containerPort: 8080
          volumeMounts:
            - mountPath: "/data"
              name: hello-service-volume
          env:
            # Use greeting from config map
            - name: GREETING
              valueFrom:
                configMapKeyRef:
                  name: hello-service-config
                  key: greeting
          resources:
            requests:
              memory: "128Mi"
              cpu: "100m" # = 0.1 cores
            limits:
              memory: "256Mi"
              cpu: "1"
          readinessProbe:
            httpGet:
              path: /actuator/health/readiness
              port: 8080
            failureThreshold: 1
            periodSeconds: 1
          livenessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 8080
            failureThreshold: 1
            periodSeconds: 1
          startupProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 8080
            failureThreshold: 60 # Service must start in 60 seconds
            periodSeconds: 1