apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-grafana-to-prometheus namespace: monitoring spec: podSelector: matchLabels: app.kubernetes.io/name: prometheus policyTypes: - Ingress ingress: - from: - podSelector: matchLabels: app.kubernetes.io/name: grafana ports: - protocol: TCP port: 9090 - protocol: TCP port: 80