apiVersion: apps/v1
kind: Deployment
metadata:
  name: static-sites
  labels:
    app: static-sites
spec:
  replicas: 1
  selector:
    matchLabels:
      app: static-sites
  template:
    metadata:
      labels:
        app: static-sites
    spec:
      containers:
      - name: nginx
        image: nginx:alpine
        ports:
        - containerPort: 80
        volumeMounts:
        - name: sites-data
          mountPath: /usr/share/nginx/html
          readOnly: true
        - name: nginx-conf
          mountPath: /etc/nginx/conf.d
          readOnly: true
        resources:
          requests:
            memory: "32Mi"
            cpu: "25m"
          limits:
            memory: "128Mi"
            cpu: "100m"
      volumes:
      - name: sites-data
        hostPath:
          path: /data/static-sites
          type: DirectoryOrCreate
      - name: nginx-conf
        configMap:
          name: static-sites-nginx-conf
---
apiVersion: v1
kind: Service
metadata:
  name: static-sites
spec:
  selector:
    app: static-sites
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
