allow-metrics-traffic.yaml 839 B

123456789101112131415161718192021222324252627
  1. # This NetworkPolicy allows ingress traffic
  2. # with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those
  3. # namespaces are able to gather data from the metrics endpoint.
  4. apiVersion: networking.k8s.io/v1
  5. kind: NetworkPolicy
  6. metadata:
  7. labels:
  8. app.kubernetes.io/name: loco-operator
  9. app.kubernetes.io/managed-by: kustomize
  10. name: allow-metrics-traffic
  11. namespace: system
  12. spec:
  13. podSelector:
  14. matchLabels:
  15. control-plane: controller-manager
  16. app.kubernetes.io/name: loco-operator
  17. policyTypes:
  18. - Ingress
  19. ingress:
  20. # This allows ingress traffic from any namespace with the label metrics: enabled
  21. - from:
  22. - namespaceSelector:
  23. matchLabels:
  24. metrics: enabled # Only from namespaces with this label
  25. ports:
  26. - port: 8443
  27. protocol: TCP