Skip to content

Exposing 9094 tcp port for alertmanager #420

@humblebundledore

Description

@humblebundledore

My understanding is that alertmanager is using port 9094 to communicate between peers in cluster mode but master/templates/alertmanager does not have references of exposing this port.

Configuring alertmanager in cluster can be done via :

config
   alertmanager:
      cluster:
        peers: 'cortex-alertmanager-headless.cortex.svc.cluster.local.:9094'        

The above configuration seems to be working :

$ k get services -n cortex | grep alertmanager
cortex-alertmanager              ClusterIP   10.xx.xx.201   <none>        8080/TCP   77d
cortex-alertmanager-headless     ClusterIP   None            <none>        8080/TCP   9d

$ k describe pods/cortex-alertmanager-0 -n cortex
    Ports:         8080/TCP, 7946/TCP

$ k describe statefulset/cortex-alertmanager -n cortex
    Ports:       8080/TCP, 7946/TCP
    Host Ports:  0/TCP, 0/TCP

$ kubectl exec -ti cortex-alertmanager-0 -c alertmanager -n cortex -- /bin/sh
/ # nc -zv 127.0.0.1:9094
127.0.0.1:9094 (127.0.0.1:9094) open
/ # nc -zv cortex-alertmanager-headless.cortex.svc.cluster.local:9094
cortex-alertmanager-headless.cortex.svc.cluster.local:9094 (10.xx.xx.119:9094) open

$ k logs -f -n cortex -l app.kubernetes.io/component=alertmanager -c alertmanager
level=debug ts=2022-12-13T07:26:33.456676073Z caller=cluster.go:337 component=cluster memberlist="2022/12/13 07:26:33 [DEBUG] memberlist: Initiating push/pull sync with: 01GKWRxxxxxxxxxQSDT73 10.xx.xx.223:9094\n"

However I believe we should expose correctly 9094, the same as it can be done via cortex-jsonnet (https://github.com/cortexproject/cortex-jsonnet) :

cortex-jsonnet/manifests ∙ grep -r "9094" ./ 
.//apps-v1.StatefulSet-alertmanager.yaml:        - --alertmanager.cluster.listen-address=[$(POD_IP)]:9094
.//apps-v1.StatefulSet-alertmanager.yaml:        - --alertmanager.cluster.peers=alertmanager-0.alertmanager.default.svc.cluster.local:9094,alertmanager-1.alertmanager.default.svc.cluster.local:9094,alertmanager-2.alertmanager.default.svc.cluster.local:9094
.//apps-v1.StatefulSet-alertmanager.yaml:        - containerPort: 9094
.//apps-v1.StatefulSet-alertmanager.yaml:        - containerPort: 9094
.//v1.Service-alertmanager.yaml:    port: 9094
.//v1.Service-alertmanager.yaml:    targetPort: 9094
.//v1.Service-alertmanager.yaml:    port: 9094
.//v1.Service-alertmanager.yaml:    targetPort: 9094

In addition, I raised an Issue to Cortex project for a know EOF error in ruler when sending alert to alertmanager and outcome seems to be exposing correctly 9094 via statefulset. cortexproject/cortex#4958

Metadata

Metadata

Labels

keepaliveKeeps Issue's from beeing closed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions