apiVersion: apps/v1
kind: Deployment
metadata:
  name: hitcounter
  labels:
    app: hitcounter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hitcounter
  template:
    metadata:
      labels:
        app: hitcounter
    spec:
      restartPolicy: Always
      containers:
      - name: hitcounter
        image: cluster-registry:32000/hitcounter:1.0
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8080
          protocol: TCP
        env:
          - name: DATABASE_URI
            valueFrom:
              secretKeyRef:
                name: redis-creds
                key: uri
        readinessProbe:
          initialDelaySeconds: 5
          periodSeconds: 30
          httpGet:
            path: /health
            port: 8080
        resources:
          limits:
            cpu: "0.5"
            memory: "64Mi"
          requests:
            cpu: "0.25"        
            memory: "32Mi"
