From 7dcae0bf1b982e1425f4989e8d0f7f2172a2e877 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Mon, 5 Feb 2024 10:37:48 -0600 Subject: [PATCH 1/9] APM Server Helm Chart Signed-off-by: Michael Montgomery --- deploy/eck-stack/Chart.yaml | 3 + .../charts/eck-apm-server/.helmignore | 24 ++++ .../charts/eck-apm-server/Chart.yaml | 10 ++ .../eck-stack/charts/eck-apm-server/LICENSE | 93 ++++++++++++++++ .../jaeger-with-http-configuration.yaml | 40 +++++++ .../charts/eck-apm-server/templates/NOTES.txt | 6 + .../eck-apm-server/templates/_helpers.tpl | 51 +++++++++ .../eck-apm-server/templates/apmserver.yaml | 54 +++++++++ .../templates/tests/apmserver_test.yaml | 87 +++++++++++++++ .../charts/eck-apm-server/values.yaml | 103 ++++++++++++++++++ .../jaeger-with-http-configuration.yaml | 71 ++++++++++++ deploy/eck-stack/values.yaml | 5 + 12 files changed, 547 insertions(+) create mode 100644 deploy/eck-stack/charts/eck-apm-server/.helmignore create mode 100644 deploy/eck-stack/charts/eck-apm-server/Chart.yaml create mode 100644 deploy/eck-stack/charts/eck-apm-server/LICENSE create mode 100644 deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml create mode 100644 deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt create mode 100644 deploy/eck-stack/charts/eck-apm-server/templates/_helpers.tpl create mode 100644 deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml create mode 100644 deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml create mode 100644 deploy/eck-stack/charts/eck-apm-server/values.yaml create mode 100644 deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml diff --git a/deploy/eck-stack/Chart.yaml b/deploy/eck-stack/Chart.yaml index f0460c0f0a..131dad8831 100644 --- a/deploy/eck-stack/Chart.yaml +++ b/deploy/eck-stack/Chart.yaml @@ -24,3 +24,6 @@ dependencies: - name: eck-logstash condition: eck-logstash.enabled version: "0.10.0-SNAPSHOT" + - name: eck-apm-server + condition: eck-apm-server.enabled + version: "0.10.0-SNAPSHOT" diff --git a/deploy/eck-stack/charts/eck-apm-server/.helmignore b/deploy/eck-stack/charts/eck-apm-server/.helmignore new file mode 100644 index 0000000000..f1568daf25 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/.helmignore @@ -0,0 +1,24 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +templates/tests diff --git a/deploy/eck-stack/charts/eck-apm-server/Chart.yaml b/deploy/eck-stack/charts/eck-apm-server/Chart.yaml new file mode 100644 index 0000000000..913c4dc39c --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v2 +name: eck-apm-server +description: Elastic APM Server managed by the ECK operator +kubeVersion: ">= 1.21.0-0" +type: application +version: 0.10.0-SNAPSHOT +sources: + - https://github.com/elastic/cloud-on-k8s + - https://github.com/elastic/apm-server +icon: https://helm.elastic.co/icons/apm.png diff --git a/deploy/eck-stack/charts/eck-apm-server/LICENSE b/deploy/eck-stack/charts/eck-apm-server/LICENSE new file mode 100644 index 0000000000..92503a7217 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/LICENSE @@ -0,0 +1,93 @@ +Elastic License 2.0 + +URL: https://www.elastic.co/licensing/elastic-license + +## Acceptance + +By using the software, you agree to all of the terms and conditions below. + +## Copyright License + +The licensor grants you a non-exclusive, royalty-free, worldwide, +non-sublicensable, non-transferable license to use, copy, distribute, make +available, and prepare derivative works of the software, in each case subject to +the limitations and conditions below. + +## Limitations + +You may not provide the software to third parties as a hosted or managed +service, where the service provides users with access to any substantial set of +the features or functionality of the software. + +You may not move, change, disable, or circumvent the license key functionality +in the software, and you may not remove or obscure any functionality in the +software that is protected by the license key. + +You may not alter, remove, or obscure any licensing, copyright, or other notices +of the licensor in the software. Any use of the licensor’s trademarks is subject +to applicable law. + +## Patents + +The licensor grants you a license, under any patent claims the licensor can +license, or becomes able to license, to make, have made, use, sell, offer for +sale, import and have imported the software, in each case subject to the +limitations and conditions in this license. This license does not cover any +patent claims that you cause to be infringed by modifications or additions to +the software. If you or your company make any written claim that the software +infringes or contributes to infringement of any patent, your patent license for +the software granted under these terms ends immediately. If your company makes +such a claim, your patent license ends immediately for work on behalf of your +company. + +## Notices + +You must ensure that anyone who gets a copy of any part of the software from you +also gets a copy of these terms. + +If you modify the software, you must include in any modified copies of the +software prominent notices stating that you have modified the software. + +## No Other Rights + +These terms do not imply any licenses other than those expressly granted in +these terms. + +## Termination + +If you use the software in violation of these terms, such use is not licensed, +and your licenses will automatically terminate. If the licensor provides you +with a notice of your violation, and you cease all violation of this license no +later than 30 days after you receive that notice, your licenses will be +reinstated retroactively. However, if you violate these terms after such +reinstatement, any additional violation of these terms will cause your licenses +to terminate automatically and permanently. + +## No Liability + +*As far as the law allows, the software comes as is, without any warranty or +condition, and the licensor will not be liable to you for any damages arising +out of these terms or the use or nature of the software, under any kind of +legal claim.* + +## Definitions + +The **licensor** is the entity offering these terms, and the **software** is the +software the licensor makes available under these terms, including any portion +of it. + +**you** refers to the individual or entity agreeing to these terms. + +**your company** is any legal entity, sole proprietorship, or other kind of +organization that you work for, plus all organizations that have control over, +are under the control of, or are under common control with that +organization. **control** means ownership of substantially all the assets of an +entity, or the power to direct its management and policies by vote, contract, or +otherwise. Control can be direct or indirect. + +**your licenses** are all the licenses granted to you for the software under +these terms. + +**use** means anything you do with the software requiring one of your licenses. + +**trademark** means trademarks, service marks, and similar rights. \ No newline at end of file diff --git a/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml b/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml new file mode 100644 index 0000000000..595cdbc810 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml @@ -0,0 +1,40 @@ +--- +# Version of APM Server. +# +version: 8.13.0-SNAPSHOT + +# Labels that will be applied to APM Server. +# +labels: {} + # key: value + +# Annotations that will be applied to APM Server. +# +annotations: {} + # key: value + +# Count of APM Server replicas to create. +# +count: 1 + +config: + name: elastic-apm + apm-server.jaeger.grpc.enabled: true + apm-server.jaeger.grpc.host: "0.0.0.0:14250" + +# Reference to ECK-managed Elasticsearch resource, ideally from {{ "elasticsearch.fullname" }} +# +elasticsearchRef: + name: eck-elasticsearch + # namespace: default +http: + service: + spec: + ports: + - name: http + port: 8200 + targetPort: 8200 + - name: grpc + port: 14250 + targetPort: 14250 + diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt b/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt new file mode 100644 index 0000000000..ff357f0f56 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt @@ -0,0 +1,6 @@ + +1. Check ApmServer status + $ kubectl get apmserver {{ include "apm-server.fullname" . }} -n {{ .Release.Namespace }} + +2. Check ApmServer pod status + $ kubectl get pods --namespace={{ .Release.Namespace }} -l apmserver.k8s.elastic.co/name={{ include "apm-server.fullname" . }} diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/_helpers.tpl b/deploy/eck-stack/charts/eck-apm-server/templates/_helpers.tpl new file mode 100644 index 0000000000..d06ca3f4af --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "apm-server.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "apm-server.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "apm-server.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "apm-server.labels" -}} +helm.sh/chart: {{ include "apm-server.chart" . }} +{{ include "apm-server.selectorLabels" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.labels }} +{{ toYaml .Values.labels }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "apm-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "apm-server.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml b/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml new file mode 100644 index 0000000000..403efb5025 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml @@ -0,0 +1,54 @@ +--- +apiVersion: apm.k8s.elastic.co/v1 +kind: ApmServer +metadata: + name: {{ include "apm-server.fullname" . }} + labels: + {{- include "apm-server.labels" . | nindent 4 }} + annotations: + eck.k8s.elastic.co/license: enterprise + {{- with .Values.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + version: {{ required "A apm-server version is required" .Values.version }} + count: {{ required "A pod count is required" .Values.count }} + {{- with .Values.image }} + image: {{ . }} + {{- end }} + {{- with .Values.serviceAccountName }} + serviceAccountName: {{ . }} + {{- end }} + {{- with .Values.revisionHistoryLimit }} + revisionHistoryLimit: {{ . }} + {{- end }} + + {{- with .Values.config }} + config: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.http }} + http: + {{- toYaml . | nindent 4 }} + {{- end }} + + {{- if not .Values.elasticsearchRef }}{{ fail "A reference to an Elasticsearch instance is required" }}{{- end }} + {{- with .Values.elasticsearchRef }} + elasticsearchRef: + {{- toYaml . | nindent 4 }} + {{- end }} + + {{- with .Values.kibanaRef }} + kibanaRef: + {{- toYaml . | nindent 4 }} + {{- end }} + + {{- with .Values.podTemplate }} + podTemplate: + {{- toYaml . | nindent 4 }} + {{- end }} + + {{- with .Values.secureSettings }} + secureSettings: + {{- toYaml . | nindent 2 }} + {{- end }} diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml b/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml new file mode 100644 index 0000000000..35bfb27ee1 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml @@ -0,0 +1,87 @@ +suite: test apmserver +templates: + - templates/apmserver.yaml +tests: + - it: should render quickstart properly + release: + name: quickstart + asserts: + - isKind: + of: ApmServer + - equal: + path: metadata.name + value: quickstart-eck-apm-server + - equal: + path: spec.version + value: 8.13.0-SNAPSHOT + - it: name override should work properly + set: + nameOverride: override + release: + name: quickstart + asserts: + - isKind: + of: ApmServer + - equal: + path: metadata.name + value: quickstart-override + - it: fullname override should work properly + set: + fullnameOverride: override + release: + name: quickstart + asserts: + - isKind: + of: ApmServer + - equal: + path: metadata.name + value: override + - it: should render custom labels, and annotations values properly + set: + labels: + test: label + annotations: + test: annotation + release: + name: quickstart + asserts: + - isKind: + of: ApmServer + - equal: + path: metadata.labels + value: + app.kubernetes.io/instance: quickstart + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: eck-apm-server + helm.sh/chart: eck-apm-server-0.10.0-SNAPSHOT + test: label + - equal: + path: metadata.annotations + value: + eck.k8s.elastic.co/license: enterprise + test: annotation + - it: should render http service properly + set: + elasticsearchRef.namespace: default + values: + - ../../examples/jaeger-with-http-configuration.yaml + release: + name: quickstart + asserts: + - isKind: + of: ApmServer + - equal: + path: metadata.name + value: quickstart-eck-apm-server + - equal: + path: spec.version + value: 8.13.0-SNAPSHOT + - equal: + path: spec.count + value: 1 + - equal: + path: spec.elasticsearchRef.name + value: eck-elasticsearch + - equal: + path: spec.elasticsearchRef.namespace + value: default diff --git a/deploy/eck-stack/charts/eck-apm-server/values.yaml b/deploy/eck-stack/charts/eck-apm-server/values.yaml new file mode 100644 index 0000000000..4d77ba6e93 --- /dev/null +++ b/deploy/eck-stack/charts/eck-apm-server/values.yaml @@ -0,0 +1,103 @@ +--- +# Default values for eck-apm-server. +# This is a YAML-formatted file. + +# Overridable names of the APM Server resource. +# By default, this is the Release name set for the chart, +# followed by 'eck-apm-server'. +# +# nameOverride will override the name of the Chart with the name set here, +# so nameOverride: quickstart, would convert to '{{ Release.name }}-quickstart' +# +# nameOverride: "quickstart" +# +# fullnameOverride will override both the release name, and the chart name, +# and will name the APM Server resource exactly as specified. +# +# fullnameOverride: "quickstart" + +# Version of APM Server. +# +version: 8.13.0-SNAPSHOT + +# APM Server Docker image to deploy +# +# image: + +# Used to check access from the current resource to a resource (for ex. a remote Elasticsearch cluster) in a different namespace. +# Can only be used if ECK is enforcing RBAC on references. +# +# serviceAccountName: "" + +# Labels that will be applied to APM Server. +# +labels: {} + +# Annotations that will be applied to APM Server. +# +annotations: {} + +# Count of APM Server replicas to create. +# +count: 1 + +# The APM Server configuration, the ECK equivalent to apm-server.yml +# ref: https://www.elastic.co/guide/en/apm/server/current/configuring-howto-apm-server.html +# +config: {} + +# Settings to control how APM Server will be accessed. +# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-accessing-elastic-services.html +# +http: {} + # service: + # metadata: + # labels: + # my-custom: label + # spec: + # type: LoadBalancer + # tls: + # selfSignedCertificate: + # # To fully disable TLS for the HTTP layer of Elasticsearch, simply + # # set the below field to 'true', removing all other fields. + # disabled: false + # subjectAltNames: + # - ip: 1.2.3.4 + # - dns: hulk.example.com + # certificate: + # secretName: custom-ca + +# Reference to ECK-managed Elasticsearch resource. +# +elasticsearchRef: + name: eck-elasticsearch + # Optional namespace reference to Elasticsearch resource. + # If not specified, then the namespace of the APM Server resource + # will be assumed. + # + # namespace: default + +# Optional reference to ECK-managed Kibana resource which allows ECK to +# automatically configure the Kibana endpoint as described in +# https://www.elastic.co/guide/en/apm/server/current/setup-kibana-endpoint.html +# +# kibanaRef: +# name: eck-kibana +# # Optional namespace reference to Kibana resource. +# # If not specified, then the namespace of the APM Server resource +# # will be assumed. +# # +# # namespace: default + +# Set podTemplate to customize the pod used by APM Server +# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-customize-pods.html +# +podTemplate: {} + +# Number of revisions to retain to allow rollback in the underlying Deployment. +# If not set Kubernetes sets this to 10 by default. +# +# revisionHistoryLimit: 2 + +# SecureSettings is a list of references to Kubernetes Secrets containing sensitive configuration options for APM Server. +secureSettings: [] diff --git a/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml b/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml new file mode 100644 index 0000000000..7cafd333d7 --- /dev/null +++ b/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml @@ -0,0 +1,71 @@ +--- +eck-elasticsearch: + enabled: true + + # Name of the Elasticsearch instance. + # + fullnameOverride: elasticsearch + + nodeSets: + - name: default + count: 3 + # Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive. + # For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144 + # and leave node.store.allow_mmap unset. + # ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html + # + config: + node.store.allow_mmap: false + +eck-kibana: + enabled: true + + # Name of the Kibana instance. + # + fullnameOverride: kibana + + config: + xpack.fleet.packages: + - name: apm + version: latest + +eck-apm-server: + enabled: true + + # Labels that will be applied to APM Server. + # + labels: {} + # key: value + + # Annotations that will be applied to APM Server. + # + annotations: {} + # key: value + + # Count of APM Server replicas to create. + # + count: 1 + + config: + name: elastic-apm + apm-server.jaeger.grpc.enabled: true + apm-server.jaeger.grpc.host: "0.0.0.0:14250" + + # Reference to ECK-managed Elasticsearch resource, ideally from {{ "elasticsearch.fullname" }} + # + elasticsearchRef: + name: elasticsearch + # namespace: default + kibanaRef: + name: kibana + http: + service: + spec: + ports: + - name: http + port: 8200 + targetPort: 8200 + - name: grpc + port: 14250 + targetPort: 14250 + diff --git a/deploy/eck-stack/values.yaml b/deploy/eck-stack/values.yaml index 381566c632..a8f3994fe3 100644 --- a/deploy/eck-stack/values.yaml +++ b/deploy/eck-stack/values.yaml @@ -39,3 +39,8 @@ eck-beats: # eck-logstash: enabled: false + +# If enabled, will use the eck-apm-server chart and deploy an APM Server resource. +# +eck-apm-server: + enabled: false From b8f86208efc402c04a5e5c86d6ddf2853456b7e8 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Tue, 6 Feb 2024 14:03:54 -0600 Subject: [PATCH 2/9] Update documentation. Update example configurations. Add basic example. Signed-off-by: Michael Montgomery --- deploy/eck-stack/README.md | 2 + .../charts/eck-apm-server/Chart.yaml | 2 +- .../jaeger-with-http-configuration.yaml | 12 +---- .../eck-apm-server/templates/apmserver.yaml | 2 +- .../charts/eck-apm-server/values.yaml | 15 ++---- .../eck-stack/examples/apm-server/basic.yaml | 52 +++++++++++++++++++ .../jaeger-with-http-configuration.yaml | 23 +++----- .../stack-helm-chart.asciidoc | 13 +++++ 8 files changed, 80 insertions(+), 41 deletions(-) create mode 100644 deploy/eck-stack/examples/apm-server/basic.yaml diff --git a/deploy/eck-stack/README.md b/deploy/eck-stack/README.md index e0b4bc7ca9..2e477217df 100644 --- a/deploy/eck-stack/README.md +++ b/deploy/eck-stack/README.md @@ -13,6 +13,7 @@ The following Elastic Stack resources are currently supported. - Fleet Server - Beats - Logstash +- Elastic standalone APM Server Additional resources will be supported in future releases of this Helm Chart. @@ -77,6 +78,7 @@ The following table lists the configurable parameters of the eck-stack chart and | `eck-agent.enabled` | If `true`, create an Elastic Agent resource (using the eck-agent Chart) | `false` | | `eck-fleet-server.enabled` | If `true`, create a Fleet Server resource (using the eck-fleet-server Chart) | `false` | | `eck-logstash.enabled` | If `true`, create a Logstash resource (using the eck-logstash Chart) | `false` | +| `eck-apm-server.enabled` | If `true`, create a standalone Elastic APM Server resource (using the eck-apm-server Chart) | `false` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. diff --git a/deploy/eck-stack/charts/eck-apm-server/Chart.yaml b/deploy/eck-stack/charts/eck-apm-server/Chart.yaml index 913c4dc39c..523b2d0878 100644 --- a/deploy/eck-stack/charts/eck-apm-server/Chart.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: eck-apm-server -description: Elastic APM Server managed by the ECK operator +description: Elastic Standalone APM Server managed by the ECK operator kubeVersion: ">= 1.21.0-0" type: application version: 0.10.0-SNAPSHOT diff --git a/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml b/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml index 595cdbc810..0422a0bb43 100644 --- a/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml @@ -3,16 +3,6 @@ # version: 8.13.0-SNAPSHOT -# Labels that will be applied to APM Server. -# -labels: {} - # key: value - -# Annotations that will be applied to APM Server. -# -annotations: {} - # key: value - # Count of APM Server replicas to create. # count: 1 @@ -22,7 +12,7 @@ config: apm-server.jaeger.grpc.enabled: true apm-server.jaeger.grpc.host: "0.0.0.0:14250" -# Reference to ECK-managed Elasticsearch resource, ideally from {{ "elasticsearch.fullname" }} +# Reference to ECK-managed Elasticsearch resource. # elasticsearchRef: name: eck-elasticsearch diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml b/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml index 403efb5025..c93e674d23 100644 --- a/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml @@ -11,7 +11,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - version: {{ required "A apm-server version is required" .Values.version }} + version: {{ required "An apm-server version is required" .Values.version }} count: {{ required "A pod count is required" .Values.count }} {{- with .Values.image }} image: {{ . }} diff --git a/deploy/eck-stack/charts/eck-apm-server/values.yaml b/deploy/eck-stack/charts/eck-apm-server/values.yaml index 4d77ba6e93..971f2d431b 100644 --- a/deploy/eck-stack/charts/eck-apm-server/values.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/values.yaml @@ -55,17 +55,10 @@ http: {} # labels: # my-custom: label # spec: - # type: LoadBalancer - # tls: - # selfSignedCertificate: - # # To fully disable TLS for the HTTP layer of Elasticsearch, simply - # # set the below field to 'true', removing all other fields. - # disabled: false - # subjectAltNames: - # - ip: 1.2.3.4 - # - dns: hulk.example.com - # certificate: - # secretName: custom-ca + # ports: + # - name: http + # port: 8200 + # targetPort: 8200 # Reference to ECK-managed Elasticsearch resource. # diff --git a/deploy/eck-stack/examples/apm-server/basic.yaml b/deploy/eck-stack/examples/apm-server/basic.yaml new file mode 100644 index 0000000000..227b58257d --- /dev/null +++ b/deploy/eck-stack/examples/apm-server/basic.yaml @@ -0,0 +1,52 @@ +--- +eck-elasticsearch: + enabled: true + + # Name of the Elasticsearch instance. + # + fullnameOverride: elasticsearch + + nodeSets: + - name: default + count: 3 + # Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive. + # For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144 + # and leave node.store.allow_mmap unset. + # ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html + # + config: + node.store.allow_mmap: false + +eck-kibana: + enabled: true + + # Name of the Kibana instance. + # + fullnameOverride: kibana + + spec: + config: + xpack.fleet.packages: + - name: apm + version: latest + +eck-apm-server: + enabled: true + + # Count of APM Server replicas to create. + # + count: 1 + + # Reference to ECK-managed Elasticsearch resource. + # + elasticsearchRef: + name: elasticsearch + kibanaRef: + name: kibana + http: + service: + spec: + ports: + - name: http + port: 8200 + targetPort: 8200 diff --git a/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml b/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml index 7cafd333d7..b694955ff3 100644 --- a/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml +++ b/deploy/eck-stack/examples/apm-server/jaeger-with-http-configuration.yaml @@ -24,24 +24,15 @@ eck-kibana: # fullnameOverride: kibana - config: - xpack.fleet.packages: - - name: apm - version: latest + spec: + config: + xpack.fleet.packages: + - name: apm + version: latest eck-apm-server: enabled: true - # Labels that will be applied to APM Server. - # - labels: {} - # key: value - - # Annotations that will be applied to APM Server. - # - annotations: {} - # key: value - # Count of APM Server replicas to create. # count: 1 @@ -51,11 +42,10 @@ eck-apm-server: apm-server.jaeger.grpc.enabled: true apm-server.jaeger.grpc.host: "0.0.0.0:14250" - # Reference to ECK-managed Elasticsearch resource, ideally from {{ "elasticsearch.fullname" }} + # Reference to ECK-managed Elasticsearch resource. # elasticsearchRef: name: elasticsearch - # namespace: default kibanaRef: name: kibana http: @@ -68,4 +58,3 @@ eck-apm-server: - name: grpc port: 14250 targetPort: 14250 - diff --git a/docs/orchestrating-elastic-stack-applications/stack-helm-chart.asciidoc b/docs/orchestrating-elastic-stack-applications/stack-helm-chart.asciidoc index d9adf02778..dc0131206d 100644 --- a/docs/orchestrating-elastic-stack-applications/stack-helm-chart.asciidoc +++ b/docs/orchestrating-elastic-stack-applications/stack-helm-chart.asciidoc @@ -73,6 +73,19 @@ helm install eck-stack-with-logstash elastic/eck-stack \ --values https://raw.githubusercontent.com/elastic/cloud-on-k8s/{eck_release_branch}/deploy/eck-stack/examples/logstash/basic-eck.yaml -n elastic-stack ---- +[float] +[id="{p}-install-apm-server-elasticsearch-kibana-helm"] +== Installing a standalone Elastic APM Server along with Elasticsearch and Kibana using the eck-stack Helm Chart + +The following section builds upon the previous sections, and allows installing a standalone Elastic APM Server along with Elasticsearch and Kibana. + +[source,sh,subs="attributes"] +---- +# Install an eck-managed Elasticsearch, Kibana, and standalone APM Server using custom values. +helm install eck-stack-with-apm-server elastic/eck-stack \ + --values https://raw.githubusercontent.com/elastic/cloud-on-k8s/{eck_release_branch}/deploy/eck-stack/examples/logstash/basic.yaml -n elastic-stack +---- + [float] [id="{p}-eck-stack-individual-components"] === Installing individual components of the Elastic Stack using the Helm Charts From 211342b13c6fe71803b5981d4fd72a4d5fd344f8 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Tue, 6 Feb 2024 14:07:49 -0600 Subject: [PATCH 3/9] Fix notes. Signed-off-by: Michael Montgomery --- deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt b/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt index ff357f0f56..b071aaf2c7 100644 --- a/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt +++ b/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt @@ -3,4 +3,4 @@ $ kubectl get apmserver {{ include "apm-server.fullname" . }} -n {{ .Release.Namespace }} 2. Check ApmServer pod status - $ kubectl get pods --namespace={{ .Release.Namespace }} -l apmserver.k8s.elastic.co/name={{ include "apm-server.fullname" . }} + $ kubectl get pods --namespace={{ .Release.Namespace }} -l apm.k8s.elastic.co/name={{ include "apm-server.fullname" . }} From 2985e284540e47c960c07e03426bd866b5750265 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Tue, 6 Feb 2024 14:17:10 -0600 Subject: [PATCH 4/9] Remove elasticsearchref from default values. Signed-off-by: Michael Montgomery --- deploy/eck-stack/charts/eck-apm-server/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/eck-stack/charts/eck-apm-server/values.yaml b/deploy/eck-stack/charts/eck-apm-server/values.yaml index 971f2d431b..b3422a5c27 100644 --- a/deploy/eck-stack/charts/eck-apm-server/values.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/values.yaml @@ -62,8 +62,8 @@ http: {} # Reference to ECK-managed Elasticsearch resource. # -elasticsearchRef: - name: eck-elasticsearch +elasticsearchRef: {} + # name: eck-elasticsearch # Optional namespace reference to Elasticsearch resource. # If not specified, then the namespace of the APM Server resource # will be assumed. From 87dcb475da1f2112e396f03419658ca311c1daff Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Tue, 6 Feb 2024 14:18:50 -0600 Subject: [PATCH 5/9] wording Signed-off-by: Michael Montgomery --- deploy/eck-stack/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/eck-stack/values.yaml b/deploy/eck-stack/values.yaml index a8f3994fe3..e2d9828b8b 100644 --- a/deploy/eck-stack/values.yaml +++ b/deploy/eck-stack/values.yaml @@ -40,7 +40,7 @@ eck-beats: eck-logstash: enabled: false -# If enabled, will use the eck-apm-server chart and deploy an APM Server resource. +# If enabled, will use the eck-apm-server chart and deploy a standalone APM Server resource. # eck-apm-server: enabled: false From ca5117ed2497d024826f0b1a9c6ba5a88b674879 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Tue, 6 Feb 2024 14:26:19 -0600 Subject: [PATCH 6/9] Set values in tests to pass. Signed-off-by: Michael Montgomery --- .../eck-apm-server/templates/tests/apmserver_test.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml b/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml index 35bfb27ee1..1d5547daf6 100644 --- a/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/templates/tests/apmserver_test.yaml @@ -3,6 +3,9 @@ templates: - templates/apmserver.yaml tests: - it: should render quickstart properly + set: + elasticsearchRef: + name: eck-elasticsearch release: name: quickstart asserts: @@ -17,6 +20,8 @@ tests: - it: name override should work properly set: nameOverride: override + elasticsearchRef: + name: eck-elasticsearch release: name: quickstart asserts: @@ -28,6 +33,8 @@ tests: - it: fullname override should work properly set: fullnameOverride: override + elasticsearchRef: + name: eck-elasticsearch release: name: quickstart asserts: @@ -42,6 +49,8 @@ tests: test: label annotations: test: annotation + elasticsearchRef: + name: eck-elasticsearch release: name: quickstart asserts: From f61bdefa38d303f0508e510275fc9f4330fc4e1c Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Wed, 7 Feb 2024 11:38:37 -0600 Subject: [PATCH 7/9] Review comments. Signed-off-by: Michael Montgomery --- deploy/eck-stack/README.md | 2 +- deploy/eck-stack/charts/eck-apm-server/Chart.yaml | 2 +- .../examples/jaeger-with-http-configuration.yaml | 1 - deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt | 4 ++-- .../eck-stack/charts/eck-apm-server/templates/apmserver.yaml | 3 +-- deploy/eck-stack/charts/eck-apm-server/values.yaml | 1 + 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/deploy/eck-stack/README.md b/deploy/eck-stack/README.md index 2e477217df..f301bd1216 100644 --- a/deploy/eck-stack/README.md +++ b/deploy/eck-stack/README.md @@ -13,7 +13,7 @@ The following Elastic Stack resources are currently supported. - Fleet Server - Beats - Logstash -- Elastic standalone APM Server +- APM Server Additional resources will be supported in future releases of this Helm Chart. diff --git a/deploy/eck-stack/charts/eck-apm-server/Chart.yaml b/deploy/eck-stack/charts/eck-apm-server/Chart.yaml index 523b2d0878..913c4dc39c 100644 --- a/deploy/eck-stack/charts/eck-apm-server/Chart.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: eck-apm-server -description: Elastic Standalone APM Server managed by the ECK operator +description: Elastic APM Server managed by the ECK operator kubeVersion: ">= 1.21.0-0" type: application version: 0.10.0-SNAPSHOT diff --git a/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml b/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml index 0422a0bb43..7c2cc661aa 100644 --- a/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/examples/jaeger-with-http-configuration.yaml @@ -16,7 +16,6 @@ config: # elasticsearchRef: name: eck-elasticsearch - # namespace: default http: service: spec: diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt b/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt index b071aaf2c7..42ab52cb95 100644 --- a/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt +++ b/deploy/eck-stack/charts/eck-apm-server/templates/NOTES.txt @@ -1,6 +1,6 @@ -1. Check ApmServer status +1. Check APM Server status $ kubectl get apmserver {{ include "apm-server.fullname" . }} -n {{ .Release.Namespace }} -2. Check ApmServer pod status +2. Check APM Server pod status $ kubectl get pods --namespace={{ .Release.Namespace }} -l apm.k8s.elastic.co/name={{ include "apm-server.fullname" . }} diff --git a/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml b/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml index c93e674d23..35a8263266 100644 --- a/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/templates/apmserver.yaml @@ -11,7 +11,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - version: {{ required "An apm-server version is required" .Values.version }} + version: {{ required "An APM Server version is required" .Values.version }} count: {{ required "A pod count is required" .Values.count }} {{- with .Values.image }} image: {{ . }} @@ -32,7 +32,6 @@ spec: {{- toYaml . | nindent 4 }} {{- end }} - {{- if not .Values.elasticsearchRef }}{{ fail "A reference to an Elasticsearch instance is required" }}{{- end }} {{- with .Values.elasticsearchRef }} elasticsearchRef: {{- toYaml . | nindent 4 }} diff --git a/deploy/eck-stack/charts/eck-apm-server/values.yaml b/deploy/eck-stack/charts/eck-apm-server/values.yaml index b3422a5c27..03b4f58319 100644 --- a/deploy/eck-stack/charts/eck-apm-server/values.yaml +++ b/deploy/eck-stack/charts/eck-apm-server/values.yaml @@ -94,3 +94,4 @@ podTemplate: {} # SecureSettings is a list of references to Kubernetes Secrets containing sensitive configuration options for APM Server. secureSettings: [] +# - secretName: my-secret-with-secure-settings From 764038da16dd25513fa6665a8c1dbd6ad72199c7 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Thu, 8 Feb 2024 10:07:03 -0600 Subject: [PATCH 8/9] Add note about requiring the apm integration since 8.0. Signed-off-by: Michael Montgomery --- .../apm-server.asciidoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc b/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc index fa4dc0e75e..3bf77b390c 100644 --- a/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc +++ b/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc @@ -106,6 +106,21 @@ spec: EOF ---- +Since stack version 8.0.0, along with specifying the `kibanaRef`, you also need to configure Kibana to include the APM integration. Add the following section to the Kibana specification: + +[source,yaml,subs="attributes,+macros"] +---- +apiVersion: kibana.k8s.elastic.co/v1 +kind: Kibana +metadata: + name: quickstart +spec: + config: + xpack.fleet.packages: + - name: apm + version: latest +---- + [id="{p}-apm-customize-configuration"] === Customize the APM Server configuration From ff04674f9e91f5f35d811071f7f4b44490d43331 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Fri, 9 Feb 2024 10:50:08 -0600 Subject: [PATCH 9/9] remove doc changes, as we'll handle in a future PR Signed-off-by: Michael Montgomery --- .../apm-server.asciidoc | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc b/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc index 3bf77b390c..fa4dc0e75e 100644 --- a/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc +++ b/docs/orchestrating-elastic-stack-applications/apm-server.asciidoc @@ -106,21 +106,6 @@ spec: EOF ---- -Since stack version 8.0.0, along with specifying the `kibanaRef`, you also need to configure Kibana to include the APM integration. Add the following section to the Kibana specification: - -[source,yaml,subs="attributes,+macros"] ----- -apiVersion: kibana.k8s.elastic.co/v1 -kind: Kibana -metadata: - name: quickstart -spec: - config: - xpack.fleet.packages: - - name: apm - version: latest ----- - [id="{p}-apm-customize-configuration"] === Customize the APM Server configuration