apiVersion: v1 kind: PersistentVolume metadata: name: prometheus-pv spec: capacity: storage: 2Gi accessModes: - ReadWriteOnce nfs: path: /mnt/nfs-share/dev/prometheus server: 192,168,2,110 readOnly: false --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: prometheus-pvc namespace: monitoring spec: volumeName: prometheus-pv accessModes: - ReadWriteOnce volumeMode: Filesystem resources: requests: storage: 2Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: prometheus-deployment namespace: monitoring labels: app: prometheus-server spec: replicas: 1 selector: matchLabels: app: prometheus-server template: metadata: labels: app: prometheus-server spec: containers: - name: prometheus image: prom/prometheus args: - "--config.file=/etc/prometheus/prometheus.yml" - "--storage.tsdb.path=/prometheus/" ports: - containerPort: 9090 volumeMounts: - name: prometheus-config-volume mountPath: /etc/prometheus/ - name: prometheus-storage-volume mountPath: /prometheus/ volumes: - name: prometheus-config-volume configMap: defaultMode: 420 name: prometheus-server-conf - name: prometheus-storage-volume persistentVolumeClaim: claimName: prometheus-pvc --- apiVersion: v1 kind: Service metadata: name: prometheus-service namespace: monitoring annotations: prometheus.io/scrape: 'true' prometheus.io/port: '9090' spec: selector: app: prometheus-server type: NodePort ports: - port: 9090 targetPort: 9090 nodePort: 30000 --- apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: name: prometheus-http-alldcs namespace: monitoring spec: entryPoints: - web routes: - match: Host(`promtheus.alldcs.nl`) kind: Rule services: - name: prometheus-service port: 8080 --- apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: name: prometheus-dev-tls namespace: monitoring spec: entryPoints: - websecure routes: - match: Host(`prometheus-dev.alldcs.nl`) kind: Rule services: - name: prometheus-service port: 8080 tls: certResolver: letsencrypt