apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: webapp
  template:
    metadata:
      labels:
        app: webapp
    spec:
      containers:
      - name: webapp
        image: fourco/go-web-aks
        resources:
          requests:
            cpu: 250m
            memory: 128Mi
          limits:
            cpu: 500m
            memory: 256Mi
        ports:
          - containerPort: 8080
        livenessProbe:
          exec:
            command:
              - cat
              - /root/app/logs/app.log
          initialDelaySeconds: 60
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /healthcheck
            port: 8080
          initialDelaySeconds: 300
          periodSeconds: 5
        env:
        - name: MY_NODE_NAME
          valueFrom:
            fieldRef:
                fieldPath: spec.nodeName
        - name: MY_NODE_IP
          valueFrom:
            fieldRef:
                fieldPath: status.hostIP
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
                fieldPath: metadata.name
        - name: MY_POD_IP
          valueFrom:
            fieldRef:
                fieldPath: status.podIP
