You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Quickstart: Monitor your Kubernetes cluster with {{agent}} [monitor-k8s-logs-metrics-with-elastic-agent]
15
15
16
-
In this quickstart guide, you’ll learn how to create the Kubernetes resources that are required to monitor your cluster infrastructure.
17
-
18
-
This new approach requires minimal configuration and provides you with an easy setup to monitor your infrastructure. You no longer need to download, install, or configure the Elastic Agent, everything happens automatically when you run the kubectl command.
19
-
20
-
The kubectl command installs the standalone Elastic Agent in your Kubernetes cluster, downloads all the Kubernetes resources needed to collect metrics from the cluster, and sends it to Elastic.
16
+
In this quickstart guide, you’ll learn how to create the Kubernetes resources required to monitor your cluster infrastructure by using a single command to download, install, and configure {{agent}} in your Kubernetes cluster.
21
17
22
18
## Prerequisites [_prerequisites_2]
23
19
24
-
::::{tab-set}
20
+
:::::{tab-set}
25
21
:group: stack-serverless
26
22
27
-
:::{tab-item} Elastic Stack
23
+
::::{tab-item} {{stack}}
28
24
:sync: stack
29
25
30
-
*An {{es}} cluster for storing and searching your data, and {{kib}} for visualizing and managing your data. This quickstart is available for all Elastic deployment models. To get started quickly, try out [{{ecloud}}](https://cloud.elastic.co/registration?page=docs&placement=docs-body).
26
+
*A running {{stack}} deployment, either self-managed or orchestrated by platforms like {{ech}}, {{ece}}, or {{eck}}, with internet access. To get started quickly, try out [{{ecloud}}](https://cloud.elastic.co/registration?page=docs&placement=docs-body).
31
27
* A user with the `superuser`[built-in role](/deploy-manage/users-roles/cluster-or-deployment-auth/built-in-roles.md) or the privileges required to onboard data.
* An {{obs-serverless}} project. To learn more, refer to [Create an Observability project](/solutions/observability/get-started.md).
49
-
* A user with the **Admin** role or higher—required to onboard system logs and metrics. To learn more, refer to [Assign user roles and privileges](/deploy-manage/users-roles/cloud-organization/user-roles.md#general-assign-user-roles).
* A user with the **Admin** role or higher (required to onboard system logs and metrics). To learn more, refer to [Assign user roles and privileges](/deploy-manage/users-roles/cloud-organization/user-roles.md#general-assign-user-roles).
44
+
* A running Kubernetes cluster with internet access
The installation command provided by the UI during the quickstart cannot be used as-is to install {{agent}} in an air-gapped environment. For an air-gapped environment with a self-managed {{stack}} deployment or orchestrator such as [{{eck}}](/deploy-manage/deploy/cloud-on-k8s.md), refer to the following resources:
-[Install Elastic Agent on Kubernetes using Helm](/reference/fleet/install-on-kubernetes-using-helm.md)
56
+
-[Deploy Elastic Agent in standalone mode with ECK](/deploy-manage/deploy/cloud-on-k8s/standalone-elastic-agent.md)
57
+
-[Run Elastic Agent in an air-gapped environment](/reference/fleet/air-gapped.md)
57
58
58
59
## Collect your data [_collect_your_data_2]
59
60
60
-
::::{tab-set}
61
+
:::::{tab-set}
61
62
:group: stack-serverless
62
63
63
-
:::{tab-item} Elastic Stack
64
+
::::{tab-item} Elastic Stack
64
65
:sync: stack
65
66
66
67
1. In {{kib}}, go to the **Observability** UI and click **Add Data**.
67
-
2.Under **What do you want to monitor?** select **Kubernetes**, and then select **Elastic Agent: Logs & Metrics**.
68
+
2.In the **What do you want to monitor?** section, select **Kubernetes**, and then select **Elastic Agent: Logs & Metrics**.
68
69
69
-
3. To install the Elastic Agent on your host, copy and run the install command.
70
+
3. To install {{agent}} on your host, copy and run the install command.
70
71
71
-
You will use the kubectl command to download a manifest file, inject user’s API key generated by {{kib}}, and create the Kubernetes resources.
72
+
By running this command, you use `kubectl kustomize` to download a manifest file, inject deployment-specific data such as the API key generated by {{kib}} for the acting user, and create the Kubernetes resources for {{agent}}.
72
73
73
-
4. Go back to the **Add Observability Data** page.
74
+
4. Go back to the **Kubernetes: Logs & Metrics** page in {{kib}}.
74
75
75
76
There might be a slight delay before data is ingested. When ready, you will see the message **We are monitoring your cluster**.
76
77
77
78
5. Click **Explore Kubernetes cluster** to navigate to dashboards and explore your data.
78
79
79
-
:::
80
+
::::
80
81
81
-
:::{tab-item} Serverless
82
+
::::{tab-item} Serverless
82
83
:sync: serverless
83
84
84
-
1.[Create a new {{obs-serverless}} project](/solutions/observability/get-started.md), or open an existing one.
85
-
2. In your {{obs-serverless}} project, go to **Add Data**.
86
-
3. Under **What do you want to monitor?** select **Kubernetes**, and then select **Elastic Agent: Logs & Metrics**.
87
-
4. To install the Elastic Agent on your host, copy and run the install command.
85
+
1. Go to your [{{obs-serverless}}](/solutions/observability/get-started.md) project, then go to **Add Data**.
86
+
2. In the **What do you want to monitor?** section, select **Kubernetes**, and then select **Elastic Agent: Logs & Metrics**.
87
+
3. To install {{agent}} on your host, copy and run the install command.
88
88
89
-
You will use the kubectl command to download a manifest file, inject user’s API key generated by Kibana, and create the Kubernetes resources.
89
+
By running this command, you use the Helm package manager to install and configure an instance of the {{agent}} Helm chart with additional deployment-specific data such as the API key generated by {{kib}} for the acting user.
90
+
91
+
The Helm chart also includes a default installation of [`kube-state-metrics` (KSM)](https://github.com/kubernetes/kube-state-metrics), which is required by the Kubernetes integration to collect cluster-level metrics.
90
92
91
-
5. Go back to the **Add Observability Data** page. There might be a slight delay before data is ingested. When ready, you will see the message **We are monitoring your cluster**.
92
-
6. Click **Explore Kubernetes cluster** to navigate to dashboards and explore your data.
93
+
If you encounter an error during the installation, refer to [Troubleshooting](#monitor-k8s-with-agent-troubleshooting).
93
94
94
-
:::
95
+
:::{dropdown} Details about the install command
96
+
The install command provided by the UI may be similar to:
- `elastic-agent` is the name of the specific installation of the Helm chart, known as **release name**.
105
+
- `elastic/elastic-agent` defines the name of the chart to install, using the format `<repository>/<chart-name>`.
106
+
- {{version.stack}} is the version of the {{agent}} Helm chart to be installed.
107
+
- `kube-system` is the namespace where {{agent}} is to be installed.
108
+
- `--set` parameters add configuration values specific to the serverless project, the acting user, and the deployment method of the Helm chart.
109
+
110
+
Refer to [Install standalone Elastic Agent on Kubernetes using Helm](/reference/fleet/example-kubernetes-standalone-agent-helm.md#agent-standalone-helm-example-install) for a more detailed explanation of the configuration options used.
111
+
:::
112
+
113
+
4. Go back to the **Kubernetes: Logs & Metrics** page in {{kib}}.
114
+
115
+
There might be a slight delay before data is ingested. When ready, you will see the message **We are monitoring your cluster**.
116
+
117
+
5. Click **Explore Kubernetes cluster** to navigate to dashboards and explore your data.
95
118
96
119
::::
97
120
121
+
:::::
98
122
99
123
## Visualize your data [_visualize_your_data_2]
100
124
@@ -107,4 +131,47 @@ After installation is complete and all relevant data is flowing into Elastic, th
107
131
108
132
Furthermore, you can access other useful prebuilt dashboards for monitoring Kubernetes resources, for example running pods per namespace, as well as the resources they consume, like CPU and memory.
109
133
110
-
Refer to [Observability overview](/solutions/observability/get-started/what-is-elastic-observability.md) for a description of other useful features.
134
+
Refer to [Observability overview](/solutions/observability/get-started/what-is-elastic-observability.md) for a description of other useful features.
135
+
136
+
## Uninstall {{agent}} from the Kubernetes cluster [monitor-k8s-with-agent-delete-agent]
137
+
138
+
::::{tab-set}
139
+
:group: stack-serverless
140
+
141
+
:::{tab-item} Elastic Stack
142
+
:sync: stack
143
+
144
+
To uninstall {{agent}} and the Kubernetes resources installed with `kubectl`:
145
+
146
+
1. Copy the `kubectl` quickstart commandforinstalling {{agent}} describedin the [Collect your data](#_collect_your_data_2) section.
147
+
2. Replace `| kubectl apply -f-` with `| kubectl delete -f-`, then run the command.
148
+
:::
149
+
150
+
:::{tab-item} Serverless
151
+
:sync: serverless
152
+
153
+
To uninstall {{agent}} and the Kubernetes resources installed with Helm, run:
154
+
155
+
```sh
156
+
helm uninstall <release-name> -n <namespace><1>
157
+
```
158
+
1. Substitute `<release-name>` with the release name and `<namespace>` with the namespace used in the quickstart command described in the [Collect your data](#_collect_your_data_2) section.
159
+
160
+
If you used the default values from the quickstart, the command would be:
If you're using `helm` to install {{agent}} in your Kubernetes cluster, you may encounter an error if `kube-state-metrics` is already installed in the same namespace where {{agent}} is to be installed. In this case, add the option `--set kube-state-metrics.enabled=false` to the install command provided by the UI to skip the installation of `kube-state-metrics`.
174
+
175
+
### The `elastic` repository already exists
176
+
177
+
If you're using `helm` to install {{agent}} in your Kubernetes cluster and the `elastic` repository is already configured on your host, replace the `helm repo add elastic https://helm.elastic.co/ ` part of the command provided by the UI with `helm repo update elastic` to ensure the repository is updated with the latest package information.
0 commit comments