|
1 | 1 | # Kubernetes integration |
2 | 2 |
|
3 | 3 | This integration is used to collect metrics from |
4 | | -[Kubernetes clusters](https://kubernetes.io/). |
5 | | - |
6 | | -As one of the main pieces provided for Kubernetes monitoring, this integration is capable of fetching metrics from several components: |
7 | | - |
8 | | -- [kubelet](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/) |
9 | | -- [kube-state-metrics](https://github.com/kubernetes/kube-state-metrics) |
10 | | -- [apiserver](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/) |
11 | | -- [controller-manager](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/) |
12 | | -- [scheduler](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/) |
13 | | -- [proxy](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/) |
14 | | - |
15 | | -Some of the previous components are running on each of the Kubernetes nodes (like `kubelet` or `proxy`) while others provide |
16 | | -a single cluster-wide endpoint. This is important to determine the optimal configuration and running strategy |
17 | | -for the different datasets included in the integration. |
18 | | - |
19 | | -For a complete reference on how to configure and run this package on Kubernetes as part of a `DaemonSet` and a `Deployment`, |
20 | | -there's a complete [example manifest](https://github.com/elastic/beats/blob/master/deploy/kubernetes/elastic-agent-kubernetes.yaml) |
21 | | -available. |
22 | | - |
23 | | -#### Kubernetes endpoints and metricsets |
24 | | - |
25 | | -Kubernetes module is a bit complex as its internal datasets require access to a wide variety of endpoints. |
26 | | - |
27 | | -This section highlights and introduces some groups of datasets with similar endpoint access needs. |
28 | | -For more details on the datasets see `configuration example` and the `datasets` sections below. |
29 | | - |
30 | | - |
31 | | -#### node / system / pod / container / module / volume |
32 | | - |
33 | | -The datasets `container`, `node`, `pod`, `system` and `volume` require access to the `kubelet endpoint` in each of |
34 | | -the Kubernetes nodes, hence it's recommended to include them as part |
35 | | -of an `Agent DaemonSet` or standalone Agents running on the hosts. |
36 | | - |
37 | | -Depending on the version and configuration of Kubernetes nodes, `kubelet` might provide a read only http port (typically 10255), |
38 | | -which is used in some configuration examples. But in general, and lately, this endpoint requires SSL (`https`) access |
39 | | -(to port 10250 by default) and token based authentication. |
40 | | - |
41 | | - |
42 | | -##### state_* and event |
43 | | - |
44 | | -All datasets with the `state_` prefix require `hosts` field pointing to `kube-state-metrics` |
45 | | -service within the cluster. As the service provides cluster-wide metrics, there's no need to fetch them per node, |
46 | | -hence the recommendation is to run these datasets as part of an `Agent Deployment` with one only replica. |
47 | | - |
48 | | -Note: Kube-state-metrics is not deployed by default in Kubernetes. For these cases the instructions for its |
49 | | -deployment are available [here](https://github.com/kubernetes/kube-state-metrics#kubernetes-deployment). |
50 | | -Generally `kube-state-metrics` runs a `Deployment` and is accessible via a service called `kube-state-metrics` on |
51 | | -`kube-system` namespace, which will be the service to use in our configuration. |
52 | | - |
53 | | -state_* datasets are not enabled by default. |
54 | | - |
55 | | -#### apiserver |
56 | | - |
57 | | -The apiserver dataset requires access to the Kubernetes API, which should be easily available in all Kubernetes |
58 | | -environments. Depending on the Kubernetes configuration, the API access might require SSL (`https`) and token |
59 | | -based authentication. |
60 | | - |
61 | | -#### proxy |
62 | | - |
63 | | -The proxy dataset requires access to the proxy endpoint in each of Kubernetes nodes, hence it's recommended |
64 | | -to configure it as a part of an `Agent DaemonSet`. |
65 | | - |
66 | | -#### scheduler and controllermanager |
67 | | - |
68 | | -These datasets require access to the Kubernetes `controller-manager` and `scheduler` endpoints. By default, these pods |
69 | | -run only on master nodes, and they are not exposed via a Service, but there are different strategies |
70 | | -available for its configuration: |
71 | | - |
72 | | -- Create `Kubernetes Services` to make `kube-controller-manager` and `kube-scheduler` available and configure |
73 | | - the datasets to point to these services as part of an `Agent Deployment`. |
74 | | -- Run these datasets as part an `Agent Daemonset` (with HostNetwork setting) with a `nodeSelector` to only run on Master nodes. |
75 | | - |
76 | | -These datasets are not enabled by default. |
77 | | - |
78 | | -Note: In some "As a Service" Kubernetes implementations, like `GKE`, the master nodes or even the pods running on |
79 | | -the masters won't be visible. In these cases it won't be possible to use `scheduler` and `controllermanager` metricsets. |
80 | | - |
81 | | -## Compatibility |
82 | | - |
83 | | -The Kubernetes package is tested with Kubernetes 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, and 1.18.x |
84 | | - |
| 4 | +[Kubernetes clusters](https://kubernetes.io/). |
0 commit comments