-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Introduce Elastic Cloud on Kubernetes (ECK) for monitoring with… #7
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
99070c8
feat: Introduce Elastic Cloud on Kubernetes (ECK) for monitoring with…
jdaln 8b78d7b
CI fix attempt
jdaln 35a25c3
one more attempt
jdaln 35a11fa
style: auto-fix YAML linting issues ✨
github-actions[bot] 2ccfc4d
Update common/monitoring/eck/README.md
jdaln 9868508
Update common/monitoring/eck/README.md
jdaln f985604
Update projects/static/mip-monitoring/mip-monitoring.yaml
jdaln c3cbb7f
Update projects/static/mip-monitoring/eck.yaml
jdaln 1236c9b
style: auto-fix YAML linting issues ✨
github-actions[bot] 36ba3eb
Update common/monitoring/eck/Chart.yaml
jdaln File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| # Manual RBAC for ECK Beats (filebeat/metricbeat). | ||
| # ECK chart templates intentionally do not include Beat RBAC resources. | ||
| # ServiceAccounts are created by the ECK Helm chart in namespace elastic-system. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: eck-filebeat | ||
| rules: | ||
| - apiGroups: [''] | ||
| resources: [pods, namespaces, nodes, endpoints, services] | ||
| verbs: [get, list, watch] | ||
| - apiGroups: [coordination.k8s.io] | ||
| resources: [leases] | ||
| verbs: [get, list, watch, create, update, delete] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: eck-metricbeat | ||
| rules: | ||
| - apiGroups: [''] | ||
| resources: [nodes, pods, namespaces, services, endpoints] | ||
| verbs: [get, list, watch] | ||
| - apiGroups: [''] | ||
| resources: [nodes/stats] | ||
| verbs: [get] | ||
| - nonResourceURLs: [/metrics] | ||
| verbs: [get] | ||
| - apiGroups: [coordination.k8s.io] | ||
| resources: [leases] | ||
| verbs: [get, list, watch, create, update, delete] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: eck-filebeat | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: eck-filebeat | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: eck-filebeat | ||
| namespace: elastic-system | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: eck-metricbeat | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: eck-metricbeat | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: eck-metricbeat | ||
| namespace: elastic-system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| apiVersion: v2 | ||
| name: elastic-operator | ||
| description: Elastic Cloud on Kubernetes (ECK) Operator | ||
| type: application | ||
| version: 1.0.0 | ||
| appVersion: 2.13.0 | ||
| dependencies: | ||
| - name: eck-operator | ||
| version: 2.13.0 | ||
| repository: https://helm.elastic.co |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| eck-operator: | ||
| createNamespace: false | ||
| webhook: | ||
| enabled: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| apiVersion: v2 | ||
| name: eck-stack-rke2 | ||
| description: Helm chart to install the Elastic Cloud on Kubernetes (ECK) operator | ||
| and sample Elastic Stack resources on an RKE2 cluster | ||
| kubeVersion: '>=1.23.0-0' | ||
| type: application | ||
| version: 0.2.0 | ||
| appVersion: 2.13.0 | ||
| icon: https://www.elastic.co/static/images/elastic-logo-200.png | ||
| keywords: [elasticsearch, eck, elastic-stack, operator] | ||
| dependencies: [] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| # ECK Helm Chart for RKE2 | ||
|
|
||
| This directory contains the ECK Helm chart. It targets managed RKE2 clusters where the Elastic Cloud on Kubernetes (ECK) operator already runs (Rancher installs it under `kube-system`). By default the chart provisions: | ||
|
|
||
| - A single-node Elasticsearch cluster plus Kibana. | ||
|
|
||
| Optional components (disabled by default): | ||
|
|
||
| - Filebeat and Metricbeat DaemonSets that forward cluster logs and metrics. | ||
| - The eck-notifier CronJob that pushes Kibana alert summaries to Microsoft Teams and Cisco Webex. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Helm 3 and `kubectl` available locally. | ||
| - RKE2 cluster v1.23+ with access to the `elastic-system` namespace. | ||
| - ECK operator 2.13+ running cluster-wide. | ||
| > **Note regarding the ECK Operator**: This chart does **not** install the operator because doing so requires cluster-admin privileges that shouldn't be granted to this standard monitoring deployment. If your hosting provider (like Rancher) already provides it, you are good to go. Otherwise, you must install the `common/elastic-operator` chart and its priviledged namespace manually or include it in your infrastructure overlays before deploying this monitoring stack. | ||
jdaln marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Default StorageClass compatible with the sample workloads (defaults assume `ceph-corbo-cephfs`). | ||
| - Namespace prepared for Beats hostPath mounts (needed only if Beats are enabled and Pod Security Admission is enforced): | ||
|
|
||
| ```bash | ||
| kubectl create namespace elastic-system | ||
| kubectl label namespace elastic-system \ | ||
| pod-security.kubernetes.io/enforce=privileged \ | ||
| pod-security.kubernetes.io/audit=privileged \ | ||
| pod-security.kubernetes.io/warn=privileged --overwrite | ||
| ``` | ||
|
|
||
| - Secret `eck-eck-notifier-secrets` populated with Elasticsearch credentials plus Teams/Webex settings (required only if `alertNotifier.enabled=true`, see [Alert notifier configuration](#alert-notifier-configuration)). | ||
| - When Beats are enabled, apply the manual RBAC manifest (the chart does not template Beat RBAC resources): | ||
|
|
||
| ```bash | ||
| kubectl apply -f base/mip-infrastructure/rbac/eck-beats-rbac.yaml | ||
| ``` | ||
|
|
||
| ## Install / upgrade | ||
|
|
||
| ```bash | ||
| helm upgrade --install eck . \ | ||
| --namespace elastic-system \ | ||
| --create-namespace \ | ||
| --skip-crds \ | ||
| --wait \ | ||
| --timeout 15m | ||
| ``` | ||
|
|
||
| > Helm 4 uses server-side apply by default. Because the ECK operator also mutates the CRs, add `--server-side=false` (or configure the same in Argo CD) for conflict-free upgrades. | ||
|
|
||
| Supply overrides through `--set`/`-f my-values.yaml` as usual. | ||
|
|
||
| ## Customising values | ||
|
|
||
| All knobs live in `values.yaml`. Common overrides: | ||
|
|
||
| - `elasticsearch.*` – adjust resources, replica count, or the StorageClass. Note: The default `storageClassName` is currently hardcoded to `ceph-corbo-cephfs` as it aligns with our current infrastructure, but you can override this for deployments in other environments. | ||
| - `kibana.ingress.*` – enable ingress, set hosts/TLS, or keep using port-forward. | ||
| - `observability.filebeat.*` / `observability.metricbeat.*` – enable and tune the DaemonSets. Filebeat defaults to 100m CPU, 400Mi request / 600Mi limit. Both use Generic Ephemeral Volumes for their `data` mounts by default (set to `ceph-corbo-cephfs` at 2Gi). | ||
| - `alertNotifier.*` – enable notifier mode, then change the Cron schedule, PVC behaviour, secret names/keys, or Teams/Webex delivery. Note: Like Elasticsearch, the notifier PVC's default `storageClassName` is hardcoded to `ceph-corbo-cephfs`. | ||
|
|
||
| ## Alert notifier configuration | ||
|
|
||
| The chart bundles the `alertNotifier` CronJob so Kibana alerts arrive in Microsoft Teams or Cisco Webex. Adjust the schedule, outputs, and credentials through values. A minimal override file could look like: | ||
|
|
||
| ```yaml | ||
| # alert-notifier-values.yaml | ||
| alertNotifier: | ||
| image: | ||
| repository: registry.example.com/eck-notifier | ||
| tag: latest | ||
| schedule: "*/5 * * * *" | ||
| es: | ||
| index: ".internal.alerts-observability.logs.alerts-default-*" | ||
| skipVerify: true | ||
| teams: | ||
| enabled: true | ||
| webex: | ||
| enabled: true | ||
| roomId: "" # leave empty to pull from the secret | ||
| personEmail: "" | ||
| tokenKey: webexBotToken | ||
| roomIdKey: webexRoomId | ||
| secret: | ||
| create: false | ||
| name: eck-eck-notifier-secrets | ||
|
|
||
| kibana: | ||
| ingress: | ||
| enabled: true | ||
| hosts: | ||
| - host: localhost | ||
| path: / | ||
| pathType: Prefix | ||
| http: | ||
| tls: | ||
| selfSignedCertificate: | ||
| disabled: true | ||
| config: | ||
| xpack.security.secureCookies: false | ||
| ``` | ||
|
|
||
| Deploy (or upgrade) the chart from the repository root: | ||
|
|
||
| ```bash | ||
| helm upgrade --install eck . -f alert-notifier-values.yaml \ | ||
jdaln marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --namespace elastic-system --create-namespace | ||
| ``` | ||
|
|
||
| ### Secret | ||
|
|
||
| Populate the notifier secret so the CronJob can talk to Elasticsearch and your chat tools: | ||
|
|
||
| ```bash | ||
| kubectl create secret generic eck-eck-notifier-secrets \ | ||
| -n elastic-system \ | ||
| --from-literal=es-url=https://elasticsearch-sample-es-http.elastic-system.svc:9200 \ | ||
| --from-literal=es-user=elastic \ | ||
| --from-literal=es-pass="<elastic-password>" \ | ||
| --from-literal=teams-webhook="https://outlook.office.com/webhook/..." \ | ||
| --from-literal=webexBotToken="<webex-bot-token>" \ | ||
| --from-literal=webexRoomId="Y2lzY29zcGFyazovL3VzL1JPT00v..." | ||
| ``` | ||
|
|
||
| If you prefer direct Webex messages, leave `webexRoomId` empty and set `alertNotifier.webex.personEmail` instead. Whenever Elasticsearch rotates the `elastic` password, regenerate the secret: | ||
|
|
||
| ```bash | ||
| ES_PASS=$(kubectl get secret elasticsearch-sample-es-elastic-user \ | ||
| -n elastic-system \ | ||
| -o go-template='{{printf "%s" (index .data "elastic")}}' | base64 -d) | ||
|
|
||
| kubectl create secret generic eck-eck-notifier-secrets \ | ||
| -n elastic-system \ | ||
| --from-literal=es-url=https://elasticsearch-sample-es-http.elastic-system.svc:9200 \ | ||
| --from-literal=es-user=elastic \ | ||
| --from-literal=es-pass="$ES_PASS" \ | ||
| --from-literal=teams-webhook="https://outlook.office.com/webhook/..." \ | ||
| --from-literal=webexBotToken="<webex-bot-token>" \ | ||
| --from-literal=webexRoomId="Y2lzY29zcGFyazovL3VzL1JPT00v..." \ | ||
| --dry-run=client -o yaml | kubectl apply -f - | ||
| ``` | ||
|
|
||
| ### Persistent state | ||
|
|
||
| The CronJob persists alert hashes under `/var/lib/eck-notifier/state.json` (PVC) so it only posts deltas. Override `alertNotifier.state.persistence.*` if you already have a claim or disable persistence for ephemeral deployments. | ||
|
|
||
| ## Verifying the deployment | ||
|
|
||
| ```bash | ||
| kubectl get elasticsearch -n elastic-system | ||
| kubectl get kibana -n elastic-system | ||
| # Optional (when enabled) | ||
| kubectl get beats.beat.k8s.elastic.co -n elastic-system | ||
| kubectl get cronjob eck-eck-notifier -n elastic-system | ||
| ``` | ||
|
|
||
| Fetch the autogenerated `elastic` password: | ||
|
|
||
| ```bash | ||
| kubectl get secret elasticsearch-sample-es-elastic-user \ | ||
| -n elastic-system \ | ||
| -o go-template='{{printf "%s" (index .data "elastic")}}' | base64 -d; echo | ||
| ``` | ||
|
|
||
| ## Accessing Kibana | ||
|
|
||
| Port-forward the service when you only need temporary access: | ||
|
|
||
| ```bash | ||
| kubectl port-forward -n elastic-system svc/kibana-sample-kb-http 5601:5601 | ||
| ``` | ||
|
|
||
| Then browse to `https://localhost:5601` (accept the self-signed cert warning) and log in with `elastic` plus the password above. To expose Kibana permanently, enable `kibana.ingress.enabled` and provide hosts/TLS values. | ||
|
|
||
| ## Observability notes | ||
|
|
||
| Filebeat autodiscovers pods via hints and forwards container logs. Metricbeat scrapes nodes, pods, containers, volumes, the apiserver, and host metrics. They are disabled by default and can be enabled through `observability.*` in `values.yaml`. | ||
|
|
||
| ## Uninstalling | ||
|
|
||
| ```bash | ||
| helm uninstall eck -n elastic-system | ||
| ``` | ||
|
|
||
| This removes Elasticsearch/Kibana/Beats/notifier workloads but leaves the upstream ECK CRDs installed (so existing CRs keep working). Delete `crds/eck-crds.yaml` manually if you also want the CRDs gone after uninstalling. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.