feat: add OSINT Dashboard Kubernetes infrastructure
- Helm chart scaffold (Chart.yaml, values.yaml, _helpers.tpl) - Namespace + RBAC manifests - PostgreSQL (CNPG, 3 replicas, PostGIS + TimescaleDB) - NATS JetStream (3 replicas, persistent, custom subjects) - Redis Sentinel (1 primary + 2 replicas, HA) - MinIO distributed (4 replicas, bucket init job) - Gateway API HTTPRoute + cert-manager TLS certificates - Monitoring stack (Prometheus, Grafana, Alertmanager, exporters) - NetworkPolicies (default deny + per-component policies) - GitHub Actions CI/CD pipeline (lint, template, security scan) - Flux CD staging overlay
This commit is contained in:
parent
a06a105f31
commit
5e477492e6
31 changed files with 2818 additions and 0 deletions
|
|
@ -0,0 +1,145 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: dashboard-web-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: web
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow from ingress controller / Gateway API
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: ingress-nginx
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3000
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow to API
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: api
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 4000
|
||||
# Allow to external APIs (GDelt, satellite providers)
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 0.0.0.0/0
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: dashboard-api-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: api
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow from web frontend
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: web
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 4000
|
||||
# Allow from ingress controller / Gateway API
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: ingress-nginx
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 4000
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow to PostgreSQL
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: database
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
# Allow to Redis
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: cache
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.redis.ports.redis }}
|
||||
# Allow to NATS
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: messaging
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.nats.ports.client }}
|
||||
# Allow to MinIO
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: object-storage
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.minio.ports.api }}
|
||||
# Allow to external APIs (GDelt, etc.)
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 0.0.0.0/0
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
{{- if .Values.networkPolicies.defaultDeny }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: default-deny-all
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector: {}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: minio-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: object-storage
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow from dashboard services
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.minio.ports.api }}
|
||||
# Allow console access (internal)
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.minio.ports.console }}
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow to other MinIO pods (distributed replication)
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: object-storage
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.minio.ports.api }}
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: monitoring-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: monitoring
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow Grafana web access
|
||||
- from: []
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.monitoring.grafana.port }}
|
||||
- protocol: TCP
|
||||
port: {{ .Values.monitoring.prometheus.port }}
|
||||
- protocol: TCP
|
||||
port: {{ .Values.monitoring.alertmanager.port }}
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow scraping all OSINT pods
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9090
|
||||
- protocol: TCP
|
||||
port: 9093
|
||||
- protocol: TCP
|
||||
port: 3000
|
||||
- protocol: TCP
|
||||
port: 9187 # postgres-exporter
|
||||
- protocol: TCP
|
||||
port: 9121 # redis-exporter
|
||||
- protocol: TCP
|
||||
port: 8222 # nats-monitor
|
||||
- protocol: TCP
|
||||
port: 9000 # minio
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: nats-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: messaging
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow client connections from dashboard services
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.nats.ports.client }}
|
||||
# Allow cluster communication
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: messaging
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.nats.ports.cluster }}
|
||||
# Allow monitoring
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: monitoring
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.nats.ports.monitor }}
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow cluster communication
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: messaging
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.nats.ports.cluster }}
|
||||
- protocol: TCP
|
||||
port: {{ .Values.nats.ports.client }}
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: postgresql-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: database
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow from dashboard API and workers
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: prometheus-exporter
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
# Allow from CNPG cluster peers (replication)
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: database
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow to other PG replicas (replication)
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: database
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
{{- if .Values.networkPolicies.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: redis-netpol
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: security
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: cache
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow from dashboard services
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.redis.ports.redis }}
|
||||
# Allow sentinel from dashboard + other sentinels
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.redis.ports.sentinel }}
|
||||
egress:
|
||||
# Allow DNS
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
# Allow to other Redis pods (replication)
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: cache
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: {{ .Values.redis.ports.redis }}
|
||||
- protocol: TCP
|
||||
port: {{ .Values.redis.ports.sentinel }}
|
||||
{{- end }}
|
||||
Loading…
Reference in a new issue