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

Add missing kubernetes fields; update istio doc to use kubernetes.pod.ip instead of host #37578

Merged
178 changes: 156 additions & 22 deletions libbeat/docs/shared-autodiscover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ Configuration parameters:
* `node` or `namespace`: Specify labels and annotations filters for the extra metadata coming from node and namespace. By default all labels are included while annotations are not. To change default behaviour `include_labels`, `exclude_labels` and `include_annotations` can be defined. Those settings are useful when storing labels and annotations that require special handling to avoid overloading the storage output.
Note: wildcards are not supported for those settings.
The enrichment of `node` or `namespace` metadata can be individually disabled by setting `enabled: false`.
* `deployment`: If resource is `pod` and it is created from a `deployment`, by default the deployment name is added, this can be disabled by setting `deployment: false`.
* `cronjob`: If resource is `pod` and it is created from a `cronjob`, by default the cronjob name is added, this can be disabled by setting `cronjob: false`.
* `deployment`: If resource is `pod` and it is created from a `deployment`, by default the deployment name isn't added, this can be enabled by setting `deployment: true`.
* `cronjob`: If resource is `pod` and it is created from a `cronjob`, by default the cronjob name isn't added, this can be enabled by setting `cronjob: true`.
+
Example:
["source","yaml",subs="attributes"]
Expand All @@ -190,8 +190,8 @@ Example:
node:
include_labels: ["nodelabel2"]
include_annotations: ["nodeannotation1"]
deployment: false
cronjob: false
deployment: true
tetianakravchenko marked this conversation as resolved.
Show resolved Hide resolved
cronjob: true
tetianakravchenko marked this conversation as resolved.
Show resolved Hide resolved
-------------------------------------------------------------------------------------

`unique`:: (Optional) Defaults to `false`. Marking an autodiscover provider as unique results into
Expand All @@ -203,39 +203,173 @@ Example:
Different Beats that refer to the same leader lease will be competitors in holding the lease
and only one will be elected as leader each time.

The configuration of templates and conditions is similar to that of the Docker provider. Configuration templates can
contain variables from the autodiscover event. They can be accessed under data namespace.
Configuration templates can contain variables from the autodiscover event. These variables can be accessed under the `data`
namespace, e.g. to access Pod IP: `${data.kubernetes.pod.ip}`.

These are the fields available within config templating. The `kubernetes.*` fields will be available on each emitted event.
These are the fields available within config templating. The `kubernetes.*` fields will be available on each emitted event:

[float]
====== Generic fields:
* host
* port (if exposed)
* kubernetes.labels
* kubernetes.annotations

[float]
====== Pod specific:
* kubernetes.container.id
* kubernetes.container.image
* kubernetes.container.name
* kubernetes.namespace
* kubernetes.node.name
* kubernetes.pod.name
* kubernetes.pod.uid
|===
|Key |Type |Description

|`kubernetes.namespace`
|`string`
|Namespace, where the Pod is running

|`kubernetes.namespace_uuid`
|`string`
|UUID of the Namespace, where the Pod is running

|`kubernetes.namespace_labels.*`
|`object`
|Labels of the Namespace, where the Pod is running. All namespace labels are available by default, see `add_resource_metadata` configuration setting above.

|`kubernetes.namespace_annotations.*`
|`object`
|Annotations of the Namespace, where the Pod is running. Namespace annotations are not available by default, see `add_resource_metadata` configuration setting above.
MichaelKatsoulis marked this conversation as resolved.
Show resolved Hide resolved

|`kubernetes.pod.name`
|`string`
|Name of the Pod

|`kubernetes.pod.uuid`
|`string`
|UUID of the Pod

|`kubernetes.pod.ip`
|`string`
|IP of the Pod

|`kubernetes.labels.*`
|`object`
|Object of the Pod labels. All labels are available by default.

|`kubernetes.annotations.*`
|`object`
|Object of the Pod annotations. Annotations are not available by default.

|`kubernetes.container.name`
|`string`
|Name of the container

|`kubernetes.container.runtime`
|`string`
|Runtime of the container

|`kubernetes.container.id`
|`string`
|ID of the container

|`kubernetes.container.image`
|`string`
|Image of the container

|`kubernetes.container.port`
|`string`
|Port of the container (if defined)

|`kubernetes.container.port_name`
|`string`
|Port's name for the container (if defined)

|`kubernetes.node.name`
|`string`
|Name of the Node

|`kubernetes.node.uid`
|`string`
|UID of the Node

|`kubernetes.node.hostname`
|`string`
|Hostname of the Node

|`kubernetes.node.labels.*`
|`string`
|Labels of the Node. All node labels are available by default, see `add_resource_metadata` configuration setting above

|`kubernetes.node.annotations.*`
|`string`
|Annotations of the Node. Node annotations are not available by default, see `add_resource_metadata` configuration setting above

|`kubernetes.deployment.name.*`
|`string`
|Deployment name of the Pod (if exists). Deployment name is not available by default, see `add_resource_metadata` configuration setting above
|===

[float]
====== Node specific:
* kubernetes.node.name
* kubernetes.node.uid
|===
|Key |Type |Description

|`kubernetes.labels.*`
|`object`
|Object of labels of the Node. All labels are available by default

|`kubernetes.annotations.*`
|`object`
|Object of labels of the Node. Annotations are not available by default
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems to be a typo here:

Suggested change
|Object of labels of the Node. Annotations are not available by default
|Object of annotations of the Node. Annotations are not available by default

Copy link
Contributor Author

@tetianakravchenko tetianakravchenko Jan 15, 2024

Choose a reason for hiding this comment

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

@belimawr done in this commit 2fbf545


|`kubernetes.node.name`
|`string`
|Name of the Node

|`kubernetes.node.uid`
|`string`
|UID of the Node

|`kubernetes.node.hostname`
|`string`
|Hostname of the Node
|===

[float]
====== Service specific:
* kubernetes.namespace
* kubernetes.service.name
* kubernetes.service.uid
* kubernetes.annotations
|===
|Key |Type |Description

|`kubernetes.namespace`
|`string`
|Namespace of the Service

|`kubernetes.namespace_uuid`
|`string`
|UUID of the Namespace of the Service

|`kubernetes.namespace_labels.*`
|`object`
|Labels of the Namespace of the Service. All namespace labels are available by default, see `add_resource_metadata` configuration setting above

|`kubernetes.namespace_annotations.*`
|`object`
|Annotations of the Namespace of the Service. Namespace annotations are not available by default, see `add_resource_metadata` configuration setting above

|`kubernetes.labels.*`
|`object`
|Object of the Service labels. All labels are available by default

|`kubernetes.annotations.*`
|`object`
|Object of the Service annotations. Annotations are not available by default

|`kubernetes.service.name`
|`string`
|Name of the Service

|`kubernetes.service.uid`
|`string`
|UID of the Service

|`kubernetes.selectors.*`
|`string`
|Kubernetes selectors
|===

If the `include_annotations` config is added to the provider config, then the list of annotations present in the config
are added to the event.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/istio/proxy/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ metricbeat.autodiscover:
config:
- module: istio
metricsets: ["proxy"]
hosts: "${data.host}:15090"
hosts: "${data.kubernetes.pod.ip}:15090"
--------------------------------------------
Loading