apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  namespace: z-test
  labels:
    tier: backend
    app: microservices
spec:
  replicas: 3
  selector:
    matchLabels:
      tier: backend
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        tier: backend
    spec:
      containers:
        - name: backend
          image: adept23/microservices-backend:1.0
          imagePullPolicy: Always
          envFrom:
            - configMapRef:
                name: urls-config
          ports:
            - containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 3              
          readinessProbe:
            httpGet:
              path: /actuator/health
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 3
          resources:
            limits:
              memory: "256Mi"
              cpu: "200m"
            requests:
              memory: "128Mi"
              cpu: "50m"
      securityContext:
        runAsUser: 1000
        runAsNonRoot: true
