Monitoring a Managed Service for Kubernetes cluster using Filebeat OSS
Filebeat OSS
To set up Managed Service for Kubernetes cluster monitoring with Filebeat OSS:
If you no longer need the resources you created, delete them.
Getting started
-
Create a Managed Service for Kubernetes cluster and a node group.
ManuallyTerraform-
If you do not have a network yet, create one.
-
If you do not have any subnets, create them in the availability zones where your Managed Service for Kubernetes cluster and node group will be created.
-
Create security groups for the Managed Service for Kubernetes cluster and its node groups.
Warning
The configuration of security groups determines the performance and availability of the cluster and the services and applications running in it.
-
Create a Managed Service for Kubernetes cluster and a node group in any suitable configuration. When creating them, specify the security groups prepared in advance.
-
If you do not have Terraform yet, install it.
-
Download the file with provider settings
. Place it in a separate working directory and specify the parameter values. -
Download the k8s-cluster.tf
configuration file of the Managed Service for Kubernetes cluster to the same working directory. The file describes:-
Managed Service for Kubernetes cluster.
-
Service account required for a Managed Service for Kubernetes cluster and node group.
-
Security groups which contain rules required for the Managed Service for Kubernetes cluster and its node groups.
Warning
The configuration of security groups determines the performance and availability of the cluster and the services and applications running in it.
-
Specify the following in the configuration file:
- Folder ID.
- Kubernetes version for a Managed Service for Kubernetes cluster and node groups.
- Managed Service for Kubernetes cluster CIDR.
- Name of the service account. It must be unique within the folder.
-
Run the
terraform init
command in the directory with the configuration files. This command initializes the provider specified in the configuration files and enables you to use the provider resources and data sources. -
Make sure the Terraform configuration files are correct using this command:
terraform validate
If there are any errors in the configuration files, Terraform will point them out.
-
Create the required infrastructure:
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
All the required resources will be created in the specified folder. You can check resource availability and their settings in the management console
. -
-
-
Install kubectl
and configure it to work with the created cluster. -
Create a Managed Service for OpenSearch cluster with any suitable configuration.
Install Filebeat OSS
Install Filebeat OSS by following this guide.
Check the result
Make sure that the Managed Service for OpenSearch cluster is receiving logs from the Managed Service for Kubernetes cluster:
Run this command:
curl \
--user admin:<admin_password_to_Managed_Service_for_OpenSearch_cluster> \
--cacert CA.pem \
--request GET 'https://<OpenSearch_DATA_host_name>:9200/_cat/indices?v'
- Connect to the Managed Service for OpenSearch cluster using OpenSearch Dashboards.
- Select the
Global
tenant. - Open the control panel by clicking
. - Under OpenSearch Plugins, select Index Management.
- Go to Indexes.
The list should contain filebeat-7.12.1-<log_date>
indexes with the Managed Service for Kubernetes cluster logs.
Delete the resources you created
Some resources are not free of charge. Delete the resources you no longer need to avoid paying for them.
Delete the Managed Service for OpenSearch cluster.
Delete the other resources depending on how they were created:
-
In the command line, go to the directory with the current Terraform configuration file with an infrastructure plan.
-
Delete the
k8s-cluster.tf
configuration file. -
Make sure the Terraform configuration files are correct using this command:
terraform validate
If there are any errors in the configuration files, Terraform will point them out.
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
All the resources described in the
k8s-cluster.tf
configuration file will be deleted. -