infra/clusters/vntx/infrastructure/monitoring/icinga2/deployment.yaml
2025-09-06 10:55:13 -05:00

159 lines
No EOL
3.3 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: icinga2-config
namespace: monitoring
data:
icinga2.conf: |
include "constants.conf"
include "zones.conf"
include <itl>
include <plugins>
include <plugins-contrib>
include <manubulon>
include <windows-plugins>
include <nscp>
include "features-enabled/*.conf"
include_recursive "conf.d"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: icinga2-data
namespace: monitoring
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: icinga2
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: icinga2
template:
metadata:
labels:
app: icinga2
spec:
containers:
- name: icinga2
image: icinga/icinga2:2.14.0
ports:
- containerPort: 5665
name: api
env:
- name: ICINGA2_MASTER
value: "1"
- name: ICINGA2_CN
value: "icinga2.monitoring.svc.cluster.local"
- name: MYSQL_HOST
value: "mariadb.monitoring.svc.cluster.local"
- name: MYSQL_DATABASE
value: "icinga2"
- name: MYSQL_USER
value: "icinga2"
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: icinga2-mysql
key: password
volumeMounts:
- name: config
mountPath: /etc/icinga2/icinga2.conf
subPath: icinga2.conf
- name: data
mountPath: /var/lib/icinga2
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "2000m"
volumes:
- name: config
configMap:
name: icinga2-config
- name: data
persistentVolumeClaim:
claimName: icinga2-data
---
apiVersion: v1
kind: Service
metadata:
name: icinga2
namespace: monitoring
spec:
selector:
app: icinga2
ports:
- port: 5665
targetPort: 5665
name: api
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: icingaweb2
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: icingaweb2
template:
metadata:
labels:
app: icingaweb2
spec:
containers:
- name: icingaweb2
image: icinga/icingaweb2:2.12.1
ports:
- containerPort: 80
name: http
env:
- name: MYSQL_HOST
value: "mariadb.monitoring.svc.cluster.local"
- name: MYSQL_DATABASE
value: "icingaweb2"
- name: MYSQL_USER
value: "icingaweb2"
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: icingaweb2-mysql
key: password
- name: ICINGA2_API_HOST
value: "icinga2.monitoring.svc.cluster.local"
- name: ICINGA2_API_PORT
value: "5665"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
name: icingaweb2
namespace: monitoring
spec:
selector:
app: icingaweb2
ports:
- port: 80
targetPort: 80
name: http