Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always pull elastic-agent image for daemonset #119

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 38 additions & 13 deletions kubernetes/elastic-helm/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ presets:
image:
repository: docker.elastic.co/beats/elastic-agent
tag: 8.16.0-SNAPSHOT
pullPolicy: Always

securityContext:
runAsUser: 0
Expand Down Expand Up @@ -68,7 +69,7 @@ config:
verbosity: basic
elasticsearch:
endpoints:
- ${env:ELASTIC_ENDPOINT}
- ${env:ELASTIC_ENDPOINT}
api_key: ${env:ELASTIC_API_KEY}
tls:
insecure: ${env:TLS_INSECURE}
Expand All @@ -80,7 +81,7 @@ config:
mode: ecs
elasticsearch/otlp:
endpoints:
- ${env:ELASTIC_ENDPOINT}
- ${env:ELASTIC_ENDPOINT}
api_key: ${env:ELASTIC_API_KEY}
tls:
insecure: ${env:TLS_INSECURE}
Expand Down Expand Up @@ -137,7 +138,7 @@ config:
resourcedetection/system:
detectors: ["system", "ec2"]
system:
hostname_sources: [ "os" ]
hostname_sources: ["os"]
resource_attributes:
host.name:
enabled: true
Expand Down Expand Up @@ -227,7 +228,6 @@ config:
# Based on https://github.com/elastic/integrations/blob/main/packages/nginx_ingress_controller/data_stream/access/elasticsearch/ingest_pipeline/default.yml
- merge_maps(attributes, ExtractGrokPatterns(body, "(%{NGINX_HOST} )?\"?(?:%{NGINX_ADDRESS_LIST:nginx_ingress_controller.access.remote_ip_list}|%{NOTSPACE:source.address}) - (-|%{DATA:user.name}) \\[%{HTTPDATE:nginx_ingress_controller.access.time}\\] \"%{DATA:nginx_ingress_controller.access.info}\" %{NUMBER:http.response.status_code:long} %{NUMBER:http.response.body.size:long} \"(-|%{DATA:http.request.referrer})\" \"(-|%{DATA:user_agent.original})\" %{NUMBER:http.request.size:long} %{NUMBER:http.request.time:double} \\[%{DATA:upstream.name}\\] \\[%{DATA:upstream.alternative_name}\\] (%{UPSTREAM_ADDRESS_LIST:upstream.address}|-) (%{UPSTREAM_RESPONSE_SIZE_LIST:upstream.response.size_list}|-) (%{UPSTREAM_RESPONSE_TIME_LIST:upstream.response.time_list}|-) (%{UPSTREAM_RESPONSE_STATUS_CODE_LIST:upstream.response.status_code_list}|-) %{GREEDYDATA:http.request.id}", true, ["NGINX_HOST=(?:%{IP:destination.ip}|%{NGINX_NOTSEPARATOR:destination.domain})(:%{NUMBER:destination.port})?", "NGINX_NOTSEPARATOR=[^\t ,:]+", "NGINX_ADDRESS_LIST=(?:%{IP}|%{WORD}) (\"?,?\\s*(?:%{IP}|%{WORD}))*", "UPSTREAM_ADDRESS_LIST=(?:%{IP}(:%{NUMBER})?)(\"?,?\\s*(?:%{IP}(:%{NUMBER})?))*", "UPSTREAM_RESPONSE_SIZE_LIST=(?:%{NUMBER})(\"?,?\\s*(?:%{NUMBER}))*", "UPSTREAM_RESPONSE_TIME_LIST=(?:%{NUMBER})(\"?,?\\s*(?:%{NUMBER}))*", "UPSTREAM_RESPONSE_STATUS_CODE_LIST=(?:%{NUMBER})(\"?,?\\s*(?:%{NUMBER}))*", "IP=(?:\\[?%{IPV6}\\]?|%{IPV4})"]), "upsert")


- merge_maps(attributes, ExtractGrokPatterns(attributes["nginx_ingress_controller.access.info"], "%{WORD:http.request.method} %{DATA:url.original} HTTP/%{NUMBER:http.version}", true), "upsert")
- delete_key(attributes, "nginx_ingress_controller.access.info")

Expand All @@ -248,7 +248,7 @@ config:

- context: log
conditions:
# Extract user agent when not empty
# Extract user agent when not empty
- attributes["user_agent.original"] != nil
statements:
# Extract UserAgent
Expand Down Expand Up @@ -292,15 +292,15 @@ config:
enabled: true
start_at: end
exclude:
# exlude collector logs
- /var/log/pods/*/opentelemetry-collector/*.log
# exlude collector logs
- /var/log/pods/*/opentelemetry-collector/*.log
include:
- /var/log/pods/*/*/*.log
- /var/log/pods/*/*/*.log
include_file_name: false
include_file_path: true
operators:
- id: container-parser
type: container
- id: container-parser
type: container
hostmetrics:
collection_interval: 10s
root_path: /hostfs
Expand Down Expand Up @@ -373,7 +373,7 @@ config:
auth_type: serviceAccount
collection_interval: 20s
endpoint: ${env:K8S_NODE_NAME}:10250
node: '${env:K8S_NODE_NAME}'
node: "${env:K8S_NODE_NAME}"
# Required to work for all CSPs without an issue
insecure_skip_verify: true
k8s_api_config:
Expand Down Expand Up @@ -408,11 +408,36 @@ config:
pipelines:
logs:
receivers: [filelog]
processors: [batch, k8sattributes, resourcedetection/system, resourcedetection/eks, resourcedetection/gcp, resource/demo, resource/k8s, resource/cloud,transform/parse_nginx_ingress_access/log, transform/parse_nginx_ingress_error/log]
processors:
[
batch,
k8sattributes,
resourcedetection/system,
resourcedetection/eks,
resourcedetection/gcp,
resource/demo,
resource/k8s,
resource/cloud,
transform/parse_nginx_ingress_access/log,
transform/parse_nginx_ingress_error/log,
]
exporters: [debug, elasticsearch/otlp]
metrics:
receivers: [hostmetrics, kubeletstats]
processors: [batch, k8sattributes, elasticinframetrics, resourcedetection/system, resource/demo, resourcedetection/eks, resourcedetection/gcp, resource/k8s, resource/cloud, attributes/dataset, resource/process]
processors:
[
batch,
k8sattributes,
elasticinframetrics,
resourcedetection/system,
resource/demo,
resourcedetection/eks,
resourcedetection/gcp,
resource/k8s,
resource/cloud,
attributes/dataset,
resource/process,
]
exporters: [debug, elasticsearch]
traces: null
telemetry:
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/elastic-helm/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ opentelemetry-collector:
image:
repository: docker.elastic.co/beats/elastic-agent
tag: 8.16.0-SNAPSHOT
pullPolicy: Always
mode: "deployment"
presets:
kubernetesAttributes:
Expand All @@ -82,7 +83,7 @@ opentelemetry-collector:
valueFrom:
secretKeyRef:
name: elastic-secret
key: elastic_apm_tls_insecure
key: elastic_apm_tls_insecure

alternateConfig:
extensions:
Expand Down
Loading