Skip to content

Commit

Permalink
observability: add container port for metrics (envoyproxy#1736)
Browse files Browse the repository at this point in the history
container port

Signed-off-by: zirain <[email protected]>
  • Loading branch information
zirain authored Aug 1, 2023
1 parent ea18f8f commit 4bba03a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/kubernetes/metric/pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: envoy-gateway-proxy-monitoring
namespace: envoy-gateway-system
spec:
selector:
matchLabels:
app.kubernetes.io/name: envoy
app.kubernetes.io/component: proxy
namespaceSelector:
any: true
jobLabel: proxy-stats
podMetricsEndpoints:
- path: /stats/prometheus
interval: 15s
port: metrics
8 changes: 8 additions & 0 deletions internal/infrastructure/kubernetes/proxy/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ func expectedProxyContainers(infra *ir.ProxyInfra, deploymentConfig *egcfgv1a1.K
proxyMetrics = infra.Config.Spec.Telemetry.Metrics
}

if proxyMetrics != nil && proxyMetrics.Prometheus != nil {
ports = append(ports, corev1.ContainerPort{
Name: "metrics",
ContainerPort: bootstrap.EnvoyReadinessPort, // TODO: make this configurable
Protocol: corev1.ProtocolTCP,
})
}

var bootstrapConfigurations string
// Get Bootstrap from EnvoyProxy API if set by the user
// The config should have been validated already
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ spec:
- containerPort: 8443
name: EnvoyHTTPSPort
protocol: TCP
- containerPort: 19001
name: metrics
protocol: TCP
resources:
requests:
cpu: 100m
Expand Down

0 comments on commit 4bba03a

Please sign in to comment.