apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-enhanced
spec:
  replicas: 3
  selector:
    matchLabels:
      deployment: pods-nginx-enhanced
  template:
    metadata:
      name: pod-nginx-enhanced
      labels:
        deployment: pods-nginx-enhanced
    spec:
      securityContext:
        runAsUser: 10000
        runAsNonRoot: true
        runAsGroup: 10001
        fsGroup: 10001 # changing ownership of a volume mounted to a pod
      containers:
      - name: nginx-enhanced-ctr
        image : k8smaestro/nginx-unprivileged:1.20.0
        imagePullPolicy: Always
        ports:
        - name: http
          containerPort: 8080
        resources:
          requests:
            memory: "100Mi"
            cpu: "200m"
          limits:
            memory: "300Mi"
            cpu: "500m"
        readinessProbe:
          httpGet:
            scheme: HTTP
            path: /index.html
            port: http
          initialDelaySeconds: 10
          periodSeconds: 3
        livenessProbe:
          httpGet:
            path: /index.html
            port: http
          failureThreshold: 1
          periodSeconds: 10