tencent cloud

masukan

Installing LogListener in Self-built Kubernetes Cluster

Terakhir diperbarui:2024-01-20 17:14:28
This document describes how to install LogListener on a self-built Kubernetes cluster to collect logs to CLS.
During the installation process, perform the following operations:
1. Dependencies
Standard Kubernetes cluster. MicroK8s, K3s, or other non-standard Kubernetes clusters are not supported.
Helm 3.1 or later is required.
2. Helm installation For detailed directions, see Installing Helm.
3. LogListener installation
wget https://mirrors.tencent.com/install/cls/k8s/tencentcloud-cls-k8s-install.sh
bash +x tencentcloud-cls-k8s-install.sh
./tencentcloud-cls-k8s-install.sh --region ap-guangzhou --secretid xxx --secretkey xxx
4. Parameter description
Parameter
Description
secretid
Tencent Cloud account access ID
secretkey
Tencent Cloud account access key
region
CLS region
docker_root
The root directory of the cluster Docker. The default value is `/var/lib/docker`. If the actual directory is different from the default one, specify the root directory of Docker.
cluster_id
Cluster ID. If it is not specified, a default ID will be generated during installation (we recommend that you specify a cluster ID, as the generated default ID is less readable).
network
Private network or public network (default).
api_network
Private network or internet (default) for TencentCloud API.
api_region
TencentCloud API region. For more information, see Available Regions.
Sample:
Component deployment in Guangzhou
./tencentcloud-cls-k8s-install.sh --secretid xxx --secretkey xx --region ap-guangzhou --network internet --api_region ap-guangzhou
5. Viewing
5.1 View the installed Helm package. After the successful installation, view the tencent-cloud-cls-log Helm package.
helm list -n kube-system
5.2 View the components.
kubectl get pods -o wide -n kube-system | grep tke-log-agent
kubectl get pods -o wide -n kube-system | grep cls-provisioner
Run the above commands to check whether all components start properly. In normal cases, a tke-log-agent collection Pod and a cls-provisioner Pod will start on each host.
6. LogListener configuration
6.1 Run the following kubectl command to modify the environment variables of tke-log-agent.
kubectl edit ds tke-log-agent -n kube-system
6.2 Edit the environment variables to define LogListener collection configuration.

tapd_20422236_base64_1673580199_31.png


6.3 Parameter description
Variable
Description
MAX_CONNECTION
Maximum number of connections, which is `10` by default.
CHECKPOINT_WINDOW_SIZE
The checkpoint window size of a file, which is `1024` by default.
MAX_FILE_BREAKPOINTS
Breakpoint file size, which is `N*2k`. `N` defaults to `8k`.
MAX_SENDRATE
Maximum sending rate (bytes/s), which is not limited by default.
MAX_FILE
Maximum number of monitored files, which is `15000` by default.
MAX_DIR
Maximum number of monitored directories, which is `5000` by default.
MAX_HTTPS_CONNECTION
Maximum number of HTTPS connections, which is `100` by default.
CONCURRENCY_TASKS
LogListener task pool, which is `256` by default (supported by v3.x or later).
PROCESS_TASKS_EVERY_LOOP
Number of tasks processed every loop, which is `4` by default.
CPU_USAGE_THRES
LogListener memory usage threshold, which is not limited by default.
7. Upgrade
7.1 For Kubernetes 1.13 or later:
wget http://mirrors.tencent.com/install/cls/k8s/upgrade/upgrade.sh
chmod +x upgrade.sh
./upgrade.sh
7.2 For Kubernetes versions earlier than 1.13:
wget http://mirrors.tencent.com/install/cls/k8s/upgrade/upgrade-1.13.sh
chmod +x upgrade-1.13.sh
./upgrade-1.13.sh
8. Uninstallation
Run the following command to uninstall the installed `tencent-cloud-cls-log` Helm package.
helm uninstall tencent-cloud-cls-log -n kube-system
Note:
To completely delete the `tencent-cloud-cls-log` package, regardless of whether you need to redeploy it after specifying the `–cluster_id` parameter incorrectly or you don't need to deploy it any more, you need to run the following command to delete the `secret` of `cls-k8s`, as it saves the `–cluster_id` parameter.
kubectl delete secret -n kube-system cls-k8s

Hubungi Kami

Hubungi tim penjualan atau penasihat bisnis kami untuk membantu bisnis Anda.

Dukungan Teknis

Buka tiket jika Anda mencari bantuan lebih lanjut. Tiket kami tersedia 7x24.

Dukungan Telepon 7x24