iac/infrastructure/opentelemetry-agent/uralkal/networkpolicy.yaml

43 lines
1.3 KiB
YAML

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: otel-agent
spec:
podSelector:
matchLabels: {app.kubernetes.io/name: otel-agent}
policyTypes: [Ingress, Egress]
ingress:
- ports:
- {port: 13133, protocol: TCP}
- from:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: vmstack}
ports:
- {port: 8888, protocol: TCP}
egress:
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: kube-system}
podSelector:
matchLabels: {k8s-app: kube-dns}
- ipBlock: {cidr: 169.254.25.10/32}
ports:
- {port: 53, protocol: UDP}
- {port: 53, protocol: TCP}
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: opentelemetry-collector}
podSelector:
matchLabels: {telemetry/collector: traces}
ports:
- {port: 4317, protocol: TCP}
# Kubernetes service / control-plane addresses depend on the live cluster.
# Restrict to private networks; verify both service and post-DNAT API ports.
- to:
- ipBlock: {cidr: 10.0.0.0/8}
- ipBlock: {cidr: 172.16.0.0/12}
- ipBlock: {cidr: 192.168.0.0/16}
ports:
- {port: 443, protocol: TCP}
- {port: 6443, protocol: TCP}