27 lines
766 B
YAML
27 lines
766 B
YAML
# Allow metrics traffic from pods in namespaces labeled 'metrics: enabled'.
|
|
# Add this label to namespaces whose pods should scrape metrics.
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: ayatori
|
|
app.kubernetes.io/managed-by: kustomize
|
|
name: allow-metrics-traffic
|
|
namespace: system
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
control-plane: controller-manager
|
|
app.kubernetes.io/name: ayatori
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
# Allow pods in namespaces labeled 'metrics: enabled' to scrape metrics.
|
|
- from:
|
|
- namespaceSelector:
|
|
matchLabels:
|
|
metrics: enabled # Only from namespaces with this label
|
|
ports:
|
|
- port: 8443
|
|
protocol: TCP
|