Skip to content

Commit

Permalink
Explicitly bind to endpoint 0.0.0.0
Browse files Browse the repository at this point in the history
For all receivers and health_check.

Adding networkpolicy for ingress on essential ports.
  • Loading branch information
tiffanny29631 committed Dec 16, 2024
1 parent 30ba466 commit 89a5757
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
2 changes: 1 addition & 1 deletion e2e/testdata/otel-collector/otel-cm-full-gcm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ data:
endpoint: 0.0.0.0:55678
exporters:
prometheus:
endpoint: :8675
endpoint: 0.0.0.0:8675
namespace: config_sync
resource_to_telemetry_conversion:
enabled: true
Expand Down
1 change: 1 addition & 0 deletions manifests/otel-agent-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ data:
detectors: [env, gcp]
extensions:
health_check:
endpoint: "0.0.0.0:13133"
service:
extensions: [health_check]
pipelines:
Expand Down
1 change: 1 addition & 0 deletions manifests/otel-agent-reconciler-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ data:
detectors: [env, gcp]
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
extensions: [health_check]
pipelines:
Expand Down
29 changes: 25 additions & 4 deletions manifests/templates/otel-collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,16 @@ data:
endpoint: 0.0.0.0:55678
exporters:
prometheus:
endpoint: :8675
endpoint: 0.0.0.0:8675
namespace: config_sync
resource_to_telemetry_conversion:
enabled: true
processors:
batch:
extensions:
health_check:
endpoint: "0.0.0.0:13133"
service:
telemetry:
metrics:
address: 0.0.0.0:55678
extensions: [health_check]
pipelines:
metrics:
Expand Down Expand Up @@ -71,6 +69,29 @@ spec:
- name: metrics # Prometheus exporter metrics.
port: 8675
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-ingress
namespace: config-management-monitoring
spec:
podSelector:
matchLabels:
app: opentelemetry
component: otel-collector
ingress:
- from:
- namespaceSelector: {}
ports:
- protocol: TCP
port: 13133
- protocol: TCP
port: 55678
- protocol: TCP
port: 8675
- protocol: TCP
port: 8888
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
20 changes: 20 additions & 0 deletions manifests/templates/reconciler-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,23 @@ spec:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-port-ingress
namespace: config-management-system
spec:
podSelector:
matchLabels: {}
ingress:
- from:
- namespaceSelector: {}
ports:
- protocol: TCP
port: 13133
- protocol: TCP
port: 55678
- protocol: TCP
port: 8888

3 changes: 2 additions & 1 deletion pkg/metrics/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
endpoint: 0.0.0.0:55678
exporters:
prometheus:
endpoint: :8675
endpoint: 0.0.0.0:8675
namespace: config_sync
resource_to_telemetry_conversion:
enabled: true
Expand Down Expand Up @@ -343,6 +343,7 @@ processors:
aggregation_type: max
extensions:
health_check:
endpoint: "0.0.0.0:13133"
service:
extensions: [health_check]
pipelines:
Expand Down

0 comments on commit 89a5757

Please sign in to comment.