2

I have an elastic stack on kubernetes (k8s) using ECK.

Kibana version: 7.13.2 Elasticsearch version: 7.13.2 APM Server version: 7.13.2 APM Agent language and version: https://www.npmjs.com/package/@elastic/apm-rum - 5.9.1 Browser version: Chrome latest

Description of the problem

Frontend apm-run agent fails to send messages to apm server. if i disable cors on the browser it works - google-chrome --disable-web-security --user-data-dir=temp then navigate to my frontend http://localhost:4201/

[Elastic APM] Failed sending events! Error: https://apm.<redacted>.com/intake/v2/rum/events HTTP status: 0
    at ApmServer._constructError (apm-server.js:120)
    at eval (apm-server.js:48)

POST https://apm.<acme>.com/intake/v2/rum/events net::ERR_BLOCKED_BY_CLIENT

Code:

apm.yml

apiVersion: apm.k8s.elastic.co/v1
kind: ApmServer
metadata:
  name: apm-server-prod
  namespace: elastic-system
spec:
  version: 7.13.2
  count: 1
  elasticsearchRef:
    name: "elasticsearch-prod"
  kibanaRef:
    name: "kibana-prod"
  http:
    service:
      spec:
        type: NodePort
  config:
    apm-server:
      rum.enabled: true
      ilm.enabled: true

elastic.ingress.yml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: elastic-ingress
  namespace: elastic-system
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: "<redacted>"
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80,"HTTPS": 443}]'
    alb.ingress.kubernetes.io/backend-protocol: 'HTTPS'
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-2:<rd>:certificate/0250a551-8971-468d-a483-cad28f890463
    alb.ingress.kubernetes.io/tags: Environment=prod,Team=dev
    alb.ingress.kubernetes.io/healthcheck-path: /health
    alb.ingress.kubernetes.io/healthcheck-interval-seconds: '300'
    alb.ingress.kubernetes.io/load-balancer-attributes: access_logs.s3.enabled=true,access_logs.s3.bucket=<redacted>-aws-ingress-logs,access_logs.s3.prefix=dev-ingress
spec:
  rules:
    - host: elasticsearch.<redacted>.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: elasticsearch-prod-es-http
                port:
                  number: 9200
    - host: kibana.<redacted>.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: kibana-prod-kb-http
                port:
                  number: 5601
    - host: apm.<redacted>.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: apm-server-prod-apm-http
                port:
                  number: 8200

frontend.js

import { init as initApm } from "@elastic/apm-rum";
import config from "<redacted>-web/config/environment";

export const apm = initApm({
  serviceName: "frontend",
  serverUrl: "https://apm.<redacted>.com",
  environment: config.environment,
  logLevel: "debug",
});

Errors in browser console:

![image|690x117](upload://6c1NfxNM1hsQmlOYnMMcg61Rsns.png) ![image|690x210](upload://xo2stNrzXpdFFTlxwhm05SaVxbf.png)

apm server:

apm-server pod does not apear to display any errors in this case, i assume the client never reaches the server .

Kay
  • 17,906
  • 63
  • 162
  • 270

1 Answers1

2

I was running into the same problem. Check your ad blocker. I found that UBlock was blocking requests to */rum/events.

I'm guessing that they consider this as a type of user "tracker" and that's why they're blocked, really no way around it though unless you change the endpoint path I guess.

Peter Peterson
  • 598
  • 4
  • 11