elastic / apm-k8s-attacher

Elastic APM Attacher for Kubernetes
https://www.elastic.co/guide/en/apm/attacher/current/apm-attacher.html
Apache License 2.0
7 stars 12 forks source link

It is not possible to deploy the Webhook and Agents in the same namespace #44

Open kuisathaverat opened 2 years ago

kuisathaverat commented 2 years ago

If you deploy the webhook and the Agents in the default namespace, the mutation does not happen, so the Agent is not configured to report APM. The same configuration on webhook and Agents works if the webhook is deployed in the namespace elastic-apm

This is the webhook configuration used.

apm:
  secret_token: SuP3RT0K3N
  namespaces:
    - default
webhookConfig:
  agents:
    java:
      image: docker.elastic.co/observability/apm-agent-java:1.33.0
      artifact: "/usr/agent/elastic-apm-agent.jar"
      environment:
        JAVA_TOOL_OPTIONS: "-javaagent:/elastic/apm/agent/elastic-apm-agent.jar"
        ELASTIC_APM_SERVER_URL: "https://apm-example.com:8200"
        ELASTIC_APM_ENVIRONMENT: "prod"
        ELASTIC_APM_LOG_LEVEL: "info"
marclop commented 2 years ago

It seems that this limitation was documented here: https://github.com/elastic/apm-mutating-webhook/blob/e75dbfe131f9abc7ca2f2a6a2db09c57299699f4/apm-agent-auto-attach/templates/webhook.yaml#L76-L86

We should update the docs to make this limitation public and obvious.

felixbarny commented 2 years ago

Could you open a docs PR for that?

axw commented 2 years ago

Maybe we could change that to use objectSelector, matching on co.elastic.traces/agent? i.e. exclude the webhook itself, without excluding everything in its namespace.