apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-go
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx-go
  template:
    metadata:
      labels:
        app: nginx-go
    spec:
      volumes:
      - name: www-data
        persistentVolumeClaim:
          claimName: www-pvc
      containers:
      - name: nginx-go
        image: fourco/nginx-go
        volumeMounts:
        - name: www-data
          mountPath: /var/www
        resources:
          requests:
            cpu: 150m
            memory: 128Mi
          limits:
            cpu: 500m
            memory: 256Mi
        ports:
        - containerPort: 80
        - containerPort: 443
        livenessProbe:
          exec:
            command:
              - cat
              - /root/app/logs/app.log
          initialDelaySeconds: 60
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /api/healthcheck
            port: 8080
          initialDelaySeconds: 300
          periodSeconds: 5
        env:
        - name: MY_NODE_NAME
          valueFrom:
            fieldRef:
                fieldPath: spec.nodeName
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
                fieldPath: metadata.name
