## Overview

The template to monitor Kubernetes nodes that work without any external scripts.
It works without external scripts and uses the script item to make HTTP requests to the Kubernetes API.

Change the values according to the environment in the file $HOME/zabbix_values.yaml.

For example:

## Enables use of **Zabbix proxy**
    enabled: false

Set the field: `Kubernetes API URL` such as `<scheme>://<host>:<port>`.

Get the generated service account token using the command:

`kubectl get secret zabbix-zabbix-helm-chart -n monitoring -o jsonpath={.data.token} | base64 -d`

Then set it to the field: `API Authorization Token`.

Set up the fields to filter the metrics of discovered nodes.


## Setup

Install the [Zabbix Helm Chart](https://git.zabbix.com/projects/ZT/repos/kubernetes-helm/browse?at=refs%2Fheads%2Frelease/7.4) in your Kubernetes cluster.

Set the following fields: `Kubernetes API URL` such as `<scheme>://<host>:<port>`.

Get the generated service account token using the command:

`kubectl get secret zabbix-zabbix-helm-chart -n monitoring -o jsonpath={.data.token} | base64 -d`

Then set it to the field: `API Authorization Token`.

Set `Nodes Endpoint Name` with Zabbix agent's endpoint name. See `kubectl -n monitoring get ep`. Default: `zabbix-zabbix-helm-chrt-agent`.

Set up the fields to filter the metrics of discovered nodes and host creation based on host prototypes:

- `Node Matches Filter`
- `Node Exclusion Filter`
- `Node Role Matches Filter`
- `Node Role Exclusion Filter`

Set up fields to filter pod metrics by namespace:

- `Pod Namespace Matches Filter`
- `Pod Namespace Exclusion Filter`

**Note:** If you have a large cluster, it is highly recommended to set a filter for discoverable pods.

You can use the `Node Labels Filter`, `Pod Labels Filter`, `Node Annotations Filter` and `Pod Annotations Filter` fields for advanced filtering of nodes and pods by labels and annotations.

Notes about labels and annotations filters:

- Values should be specified separated by commas and must have the key/value form with support for regular expressions in the value (`key1: value, key2: regexp`).
- ECMAScript syntax is used for regular expressions.
- Filters are applied if such a label key exists for the entity that is being filtered (it means that if you specify a key in a filter, entities which do not have this key will not be affected by the filter and will still be discovered, and only entities containing that key will be filtered by the value).
- You can also use the exclamation point symbol (`!`) to invert the filter (`!key: value`).

For example: `kubernetes.io/hostname: kubernetes-node[5-25], !node-role.kubernetes.io/ingress: .*`. As a result, the nodes 5-25 without the "ingress" role will be discovered.


See the Kubernetes documentation for details about labels and annotations:

- <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/>
- <https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/>

**Note:** the discovered nodes will be created as separate hosts in Zabbix with the Linux template automatically assigned to them.