apiVersion: apps/v1
kind: Deployment
metadata:
  name: fileserver
  namespace: default
  labels:
    app: fileserver
spec:
  replicas: 2
  selector:
    matchLabels:
      app: fileserver
  template:
    metadata:
      labels:
        app: fileserver
    spec:
      containers:
        - name: fileserver
          image: nginx:latest
          imagePullPolicy: IfNotPresent
          readinessProbe:
            httpGet:
              port: 80
              path: /
          livenessProbe:
            httpGet:
              port: 80
              path: /
          lifecycle:
            preStop:
              exec:
                command: [ "usr/sbin/nginx", "-s", "quit" ]
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always