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

feat(helm): implementation of integrations chart #7356

Closed
wants to merge 11 commits into from
Closed
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
23,380 changes: 16,458 additions & 6,922 deletions NOTICE.txt

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions deploy/eck-integrations/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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/
6 changes: 6 additions & 0 deletions deploy/eck-integrations/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: eck-integrations
description: Elastic Stack integrations
kubeVersion: ">= 1.21.0-0"
type: application
version: 0.0.1
93 changes: 93 additions & 0 deletions deploy/eck-integrations/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
58 changes: 58 additions & 0 deletions deploy/eck-integrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ECK-Integrations

ECK Integrations is a Helm chart to assist in the deployment of Elastic integrations, which are
managed by the [ECK Operator](https://www.elastic.co/guide/en/cloud-on-k8s/current/index.html)

## Supported Elastic Integrations

The following Elastic integrations are currently supported.

- Kubernetes

Additional integrations will be supported in future releases of this Helm Chart.

## Prerequisites

- Kubernetes 1.21+
- Elastic ECK Operator

## Installing the Chart

### Installing the ECK Operator

Before using this chart, the Elastic ECK Operator is required to be installed within the Kubernetes cluster.
Full installation instructions can be found within [our documentation](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-installing-eck.html)

To install the ECK Operator using Helm.

```sh
# Add the Elastic Helm Repository
helm repo add elastic https://helm.elastic.co && helm repo update

# Install the ECK Operator cluster-wide
helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace
```

Additional ECK Operator Helm installation options can be found within [our documentation](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-install-helm.html)

### Installing Kubernetes ECK Integration

// TODO(panosk)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some possible examples to put here:

Suggested change
// TODO(panosk)
To enable all Kubernetes monitoring capabilities for metrics and logs:
helm install k8s-monitoring elastic/eck-integrations -n elastic-system --create-namespace \
--set elasticsearch.host=https://elasticsearch:9200,elasticsearch.api_key=XXXX \
--set kubernetes.enabled=true
To only enable logs:
helm install k8s-monitoring elastic/eck-integrations -n elastic-system --create-namespace \
--set elasticsearch.host=https://elasticsearch:9200,elasticsearch.api_key=XXXX \
--set kubernetes.enabled=true,kubernetes.metrics.enabled=false
To enable Cloud Defend:
helm install k8s-monitoring elastic/eck-integrations -n elastic-system --create-namespace \
--set elasticsearch.host=https://elasticsearch:9200,elasticsearch.api_key=XXXX \
--set cloudDefend.enabled=true

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these examples need to mention the secret or the elasticearchRef setup required.


## Uninstalling the Chart

To uninstall/delete the `my-release` deployment from the 'elastic-stack' namespace:

```console
helm delete my-release -n elastic-stack
```

The command removes all the Elastic Stack resources associated with the chart and deletes the release.

## Configuration

// TODO(panosk)

## Contributing

// TODO(panosk)
15 changes: 15 additions & 0 deletions deploy/eck-integrations/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Examples of chart configuration

Here is a collection of example configurations for the eck-integrations chart.

- [Kubernetes - defaults](kubernetes-default)
- [Kubernetes - only container logs](kubernetes-only-logs)
- [Kubernetes - only hints autodiscover](kubernetes-hints-autodiscover)
- [Custom Integration - nginx](nginx-custom-integration)
- [Multiple Integrations](multiple-integrations)

Useful links:

- [Kibana - Install and uninstall Elastic Agent integration assets](https://www.elastic.co/guide/en/fleet/current/install-uninstall-integration-assets.html)
- [Kibana - Creating API Keys](https://www.elastic.co/guide/en/kibana/current/api-keys.html)
- [Kibana - Create roles and users](https://www.elastic.co/guide/en/kibana/current/using-kibana-with-security.html#security-create-roles)
45 changes: 45 additions & 0 deletions deploy/eck-integrations/examples/kubernetes-default/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Example: Kubernetes Integration with default chart values

In this example we install the built-in `kubernetes` integration with the default built-in values.

## Prerequisites:
1. Installed eck-operator Helm chart
```console
helm repo add elastic https://helm.elastic.co && helm repo update
helm install elastic-operator elastic/eck-operator --create-namespace
```
2. For **non** eck-managed Elasticsearch clusters you need a k8s secret that contains the connection details to it such as:
1. with a Username and Password ([Kibana - Create roles and users](https://www.elastic.co/guide/en/kibana/current/using-kibana-with-security.html#security-create-roles)):
```console
kubectl create secret generic es-ref-secret \
--from-literal=username=... \
--from-literal=password=... \
--from-literal=url=...
```
2. with an API key ([Kibana - Creating API Keys](https://www.elastic.co/guide/en/kibana/current/api-keys.html)):
```console
kubectl create secret generic es-ref-secret \
--from-literal=api-key=... \
--from-literal=url=...
```

3. `kubernetes` integration assets are installed through Kibana ([Kibana - Install and uninstall Elastic Agent integration assets](https://www.elastic.co/guide/en/fleet/current/install-uninstall-integration-assets.html))

## Run:
1. For **non** eck-managed Elasticsearch clusters
```console
helm install eck-integrations ../../ \
-f ./agent-kubernetes.yaml \
--set elasticsearchRefs.default.secretName=es-ref-secret
```
For eck-managed Elasticsearch clusters
```console
helm install eck-integrations ../../ \
-f ./agent-kubernetes.yaml \
--set elasticsearchRefs.default.name=eck-es-name
```


## Validate:

1. The Kibana `kubernetes`-related dashboards should start showing up the respective info.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kubernetes:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Example: Kubernetes Integration with hint-based autodiscover

In this example we install the built-in `kubernetes` integration and enable the feature of hint-based autodiscover. With this feature, the kubernetes integration can monitor the creation of pods that bear specific annotations based on which the agent loads dynamically the respective integration. In the context of this example, we showcase hint-based autodiscover with `redis` integration.

## Prerequisites:
1. Installed eck-operator Helm chart
```console
helm repo add elastic https://helm.elastic.co && helm repo update
helm install elastic-operator elastic/eck-operator --create-namespace
```
2. For **non** eck-managed Elasticsearch clusters you need a k8s secret that contains the connection details to it such as:
1. with a Username and Password ([Kibana - Create roles and users](https://www.elastic.co/guide/en/kibana/current/using-kibana-with-security.html#security-create-roles)):
```console
kubectl create secret generic es-ref-secret \
--from-literal=username=... \
--from-literal=password=... \
--from-literal=url=...
```
2. with an API key ([Kibana - Creating API Keys](https://www.elastic.co/guide/en/kibana/current/api-keys.html)):
```console
kubectl create secret generic es-ref-secret \
--from-literal=api-key=... \
--from-literal=url=...
```

3. `redis` integration assets are installed through Kibana ([Kibana - Install and uninstall Elastic Agent integration assets](https://www.elastic.co/guide/en/fleet/current/install-uninstall-integration-assets.html))

## Run:
1. For **non** eck-managed Elasticsearch clusters
```console
helm install eck-integrations ../../ \
-f ./agent-kubernetes.yaml \
--set elasticsearchRefs.default.secretName=es-ref-secret
```
For eck-managed Elasticsearch clusters
```console
helm install eck-integrations ../../ \
-f ./agent-kubernetes.yaml \
--set elasticsearchRefs.default.name=eck-es-name
```

2. Install a redis pod with the appropriate annotations
```console
kubectl apply -f ./redis.yaml
```

## Validate:

1. The Kibana `redis`-related dashboards should start showing up the respective info.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kubernetes:
enabled: true
hints:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: v1
kind: Pod
metadata:
name: redis
annotations:
co.elastic.hints/package: redis
co.elastic.hints/data_streams: info
co.elastic.hints/host: '${kubernetes.pod.ip}:6379'
co.elastic.hints/info.period: 5s
labels:
k8s-app: redis
app: redis
spec:
containers:
- name: redis
image: redis:5.0.4
command:
- redis-server
- "/redis-master/redis.conf"
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: example-redis-config
items:
- key: redis-config
path: redis.conf
---
apiVersion: v1
kind: ConfigMap
metadata:
name: example-redis-config
data:
redis-config: |
maxmemory 2mb
maxmemory-policy allkeys-lru
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
type: ClusterIP
ports:
- port: 6379
targetPort: 6379
name: client
selector:
app: redis
Loading