<commit_before># Agent Check: Kubernetes API server metrics

## Overview

This check monitors [Kube_apiserver_metrics][1].

## Setup

### Installation

The Kube_apiserver_metrics check is included in the [Datadog Agent][2] package, so you do not need to install anything else on your server.

### Configuration

The main use case to run the kube_apiserver_metrics check is as a Cluster Level Check.
Refer to the dedicated documentation for [Cluster Level Checks][3].
You can annotate the service of your apiserver with the following:
```
Annotations:       ad.datadoghq.com/endpoint.check_names: ["kube_apiserver_metrics"]
                   ad.datadoghq.com/endpoint.init_configs: [{}]
                   ad.datadoghq.com/endpoint.instances:
                     [
                       {
                         "prometheus_url": "%%host%%:%%port%%/metrics",
                         "bearer_token_auth": "true"
                       }
                     ]
                   ad.datadoghq.com/service.check_names: [""]
                   ad.datadoghq.com/service.init_configs: [{}]
                   ad.datadoghq.com/service.instances: [{}]
```
Then the Datadog Cluster Agent schedules the check(s) for each endpoint onto Datadog Agent(s).

Disclaimer: Your apiserver(s) need to run as pods, other methods (e.g. systemd unit) are not supported at the moment.

You can also run the check by configuring the endpoints directly in the `kube_apiserver_metrics.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent’s configuration directory][4].
See the [sample kube_apiserver_metrics.d/conf.yaml][2] for all available configuration options.

By default the Agent running the check tries to get the service account bearer token to authenticate against the APIServer. If you are not using RBACs, set `bearer_token_auth` to `false`.

Finally, if you run the Datadog Agent on the master nodes, you can rely on [Autodiscovery][5] to schedule the check. It is automatic if you are running the official image `k8s.gcr.io/kube-apiserver`.

2. [Restart the Agent][6].

### Validation

[Run the Agent's status subcommand][7] and look for `kube_apiserver_metrics` under the Checks section.

## Data Collected

### Metrics

See [metadata.csv][8] for a list of metrics provided by this integration.

### Service Checks

Kube_apiserver_metrics does not include any service checks.

### Events

Kube_apiserver_metrics does not include any events.

## Troubleshooting

Need help? Contact [Datadog support][9].

[1]: https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver
[2]: https://github.com/DataDog/integrations-core/blob/master/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/data/conf.yaml.example
[3]: https://docs.datadoghq.com/agent/autodiscovery/clusterchecks
[4]: https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory
[5]: https://docs.datadoghq.com/agent/autodiscovery/?tab=kubernetes
[6]: https://docs.datadoghq.com/agent/faq/agent-commands/#start-stop-restart-the-agent
[7]: https://docs.datadoghq.com/agent/faq/agent-commands/#agent-status-and-information
[8]: https://github.com/DataDog/integrations-core/blob/master/kube_apiserver_metrics/metadata.csv
[9]: https://docs.datadoghq.com/help<commit_msg>Remove useless instruction (#4123)<commit_after># Agent Check: Kubernetes API server metrics

## Overview

This check monitors [Kube_apiserver_metrics][1].

## Setup

### Installation

The Kube_apiserver_metrics check is included in the [Datadog Agent][2] package, so you do not need to install anything else on your server.

### Configuration

The main use case to run the kube_apiserver_metrics check is as a Cluster Level Check.
Refer to the dedicated documentation for [Cluster Level Checks][3].
You can annotate the service of your apiserver with the following:
```
Annotations:       ad.datadoghq.com/endpoint.check_names: ["kube_apiserver_metrics"]
                   ad.datadoghq.com/endpoint.init_configs: [{}]
                   ad.datadoghq.com/endpoint.instances:
                     [
                       {
                         "prometheus_url": "%%host%%:%%port%%/metrics",
                         "bearer_token_auth": "true"
                       }
                     ]
                   ad.datadoghq.com/service.check_names: [""]
                   ad.datadoghq.com/service.init_configs: [{}]
                   ad.datadoghq.com/service.instances: [{}]
```
Then the Datadog Cluster Agent schedules the check(s) for each endpoint onto Datadog Agent(s).

Disclaimer: Your apiserver(s) need to run as pods, other methods (e.g. systemd unit) are not supported at the moment.

You can also run the check by configuring the endpoints directly in the `kube_apiserver_metrics.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent’s configuration directory][4].
See the [sample kube_apiserver_metrics.d/conf.yaml][2] for all available configuration options.

By default the Agent running the check tries to get the service account bearer token to authenticate against the APIServer. If you are not using RBACs, set `bearer_token_auth` to `false`.

Finally, if you run the Datadog Agent on the master nodes, you can rely on [Autodiscovery][5] to schedule the check. It is automatic if you are running the official image `k8s.gcr.io/kube-apiserver`.

### Validation

[Run the Agent's status subcommand][6] and look for `kube_apiserver_metrics` under the Checks section.

## Data Collected

### Metrics

See [metadata.csv][7] for a list of metrics provided by this integration.

### Service Checks

Kube_apiserver_metrics does not include any service checks.

### Events

Kube_apiserver_metrics does not include any events.

## Troubleshooting

Need help? Contact [Datadog support][8].

[1]: https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver
[2]: https://github.com/DataDog/integrations-core/blob/master/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/data/conf.yaml.example
[3]: https://docs.datadoghq.com/agent/autodiscovery/clusterchecks
[4]: https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory
[5]: https://docs.datadoghq.com/agent/autodiscovery/?tab=kubernetes
[6]: https://docs.datadoghq.com/agent/faq/agent-commands/#agent-status-and-information
[7]: https://github.com/DataDog/integrations-core/blob/master/kube_apiserver_metrics/metadata.csv
[8]: https://docs.datadoghq.com/help
{'fraction_non_alphanumeric': 0.10491551459293395, 'fraction_numerical': 0.006605222734254993, 'mean_word_length': 3.578762306610408, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 17, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1985819', 'n_tokens_mistral': 2055, 'n_tokens_neox': 1943, 'n_words': 568}