apiVersion: v1
kind: Namespace
metadata:
  name: nginx
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: nginx-pv
spec:
  storageClassName: ""
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  mountOptions:
    - hard
    - nfsvers=4.1
  nfs:
    server: 192.168.2.110
    path: /mnt/nfs_share/nginx-dev
    readOnly: false
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nginx-pvc
  namespace: nginx
spec:
  storageClassName: ""
  volumeName: nginx-pv
  accessModes:
    - ReadWriteMany
  volumeMode: Filesystem
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: nginx
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: nginx
          subPath: html
        ports:
        - containerPort: 80
      volumes:
      - name: nginx
        persistentVolumeClaim:
          claimName: nginx-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  namespace: nginx
  labels:
    name: nginx
spec:
  type: ClusterIP
  ports:
    - port: 80
      name: http
  selector:
    app: nginx
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: nginx-tls-allarddcs
  namespace: nginx
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`nginx-dev.allarddcs.nl`)
    kind: Rule
    services:
    - name: nginx
      port: 80
  tls:
    certResolver: letsencrypt
