tencent cloud

Feedback

Integration with TKE

Last updated: 2024-11-28 14:27:07
    You can monitor the TKE service in business scenarios after integrating it. This document describes how to integrate the TKE service.
    Tencent Kubernetes Engine (TKE) provides container-centric solutions based on native Kubernetes. It can solve environment-related issues in the process of development, testing, and Ops, helping you reduce costs and improve efficiency. Kubernetes is an open-source container orchestration tool developed by Google and has been used by Google for more than 15 years. As the de facto standard in the container field, Kubernetes can greatly simplify the management and deployment complexity of applications. By integrating with the TKE service, you can monitor the status of Kubernetes and the services running on it much more easily through Prometheus.
    Note
    In order to ensure normal operation, existing instances will automatically update the component version when you edit collection configuration and associate new clusters. During the update process, data breakpoints may occur in the associated clusters.

    Directions

    1. Log in to the TMP console.
    2. In the TMP instance list, click the ID/Name of the newly created instance.
    3. Go to the TMP management center and click Integrate with TKE on the left sidebar.
    4. Perform the following operations on the cluster monitoring page:
    Associate a cluster: Associate a cluster with a TMP instance as instructed in Associating with Cluster.
    Configure data collection: Create a data collection rule to monitor your business data by adding the configuration in the console or via a YAML file. For more information, see Data Collection Configurations.
    Streamline basic monitoring metrics: Select only the required metrics to avoid unnecessary fees as instructed Streamlining Monitoring Metrics.
    5. After completing the above operations, you can view the monitoring data of your TKE service in Grafana.
    
    
    

    Associating with a Cluster

    Note:
    After a cluster is associated, the monitoring data collection plugin is automatically installed in the cluster. The plugin is deleted altogether if you disassociate the cluster. Currently, cross-VPC association is supported to allow you to monitor clusters in different VPCs of different regions using the same monitoring instance.

    Prerequisites

    You have logged in to the TCOP Console and created a cluster in the console.
    You have created a Prometheus instance.

    Operations

    Associating with a Kubernetes Cluster on Tencent Cloud

    1. Log in to the TCOP Console and select Managed Service for Prometheus from the left navigation bar.
    2. On the instance list page, select the name of the instance requiring cluster association to go to the instance details page.
    3. In the top navigation bar, click Data Collection > Integrate with TKE > Associate Cluster.
    4. In the Associate Cluster window, select the related cluster.
    
    
    
    Cluster Type: You can select a standard cluster of TKE, a Serverless cluster, an edge cluster, or an external cluster.
    Cross-VPC Association: After enabling this feature, you can monitor clusters in different VPCs of different regions using the same monitoring instance.
    Create Public Network CLB Instance: If your instance's VPC is interoperable with the network of the cluster you want to associate, you do not need to create it; if the VPC of your instance is not interoperable with the network of the cluster you want to associate, you must select Create Public Network CLB; otherwise, data acquisition across VPC clusters cannot be performed. For example, if the VPC of your instance and the VPC of the cluster you want to associate are already connected via CCN, you do not need to create a Public Network CLB.
    Cluster Region: Select the region in which the cluster resides.
    Cluster: Select the cluster to be associated with. You can select multiple clusters.
    Global Label: Used to assign the same key-value pair to each monitoring indicator.
    5. Click OK to associate the selected cluster with the current monitoring instance.

    Associating with an External Kubernetes Cluster

    1. Log in to the TCOP console, and click Managed Service for Prometheus in the left navigation bar.
    2. On the instance list page, select the name of the instance requiring cluster association to go to the instance details page.
    3. In the top navigation bar, click Data Collection > Integrate with TKE > Associate Cluster.
    4. In the Associate Cluster window, select an external cluster.
    
    
    
    External cluster name: Give a name to the cluster.
    Region of the external cluster: Select the region or adjacent region where the cluster is to be registered.
    Global Label: Used to assign the same key-value pair to each monitoring indicator.
    5. Click OK to start initialization, which will generate a Cluster ID.
    6. Register an external cluster.
    
    
    
    After the initialization is successful, click Wait for Registration. The YAML file for Job installation is displayed. Run the helm command in the Job to install collection-related components. For more information about components and related permissions, see Internal Installation Component Description in the TKE Cluster. The following table describes the main parameters of the Job.
    Parameter
    Description
    timeout
    The timeout period for helm installation. If a timeout occurs, rollback is automatically performed.
    proxyAgent.enabled
    Specifies whether to install the proxy-agent. It is recommended to set this parameter to true to ensure successful registration.
    proxyAgent.instanceId
    Instance ID
    proxyAgent.instanceToken
    The instance token.
    proxyAgent.clusterId
    The cluster ID.
    proxyAgent.clusterType
    Cluster Type
    proxyAgent.serverAddress
    The public IP address of the instance that is used for collection registration. Only user clusters accessible to the IP address can be successfully registered.
    proxyAgent.image
    The image of the proxy-agent.
    kubeStateMetrics.enabled
    Specifies whether to install the kube-state-metrics component. You can set this parameter to false if you do not want to install the component or if the component is installed.
    kubeStateMetrics.image
    The image of kube-state-metrics.
    nodeExporter.enabled
    Specifies whether to install the node-exporter component. You can set this parameter to false if you do not want to install the component or if the component is installed.
    nodeExporter.image
    The image of node-exporter.
    Create a Job and view the Job running result.
    # Install and register the task.
    kubectl apply -f <yaml>
    # Set the namespace.
    export KUBE_NS=<Instance ID>
    # View the Job running status.
    kubectl get job proxy-agent-installer -n ${KUBE_NS}
    # View the Job POD. You can check error logs if an error occurs.
    kubectl get pods -l job-name=proxy-agent-installer -n ${KUBE_NS}
    Check whether the proxy-agent log contains "conn is active", which should be contained in normally registered logs. If not, check whether the cluster can access the IP:Port specified by the proxyAgent.serverAddress.
    # Obtain the pod name of the proxy-agent.
    export KUBE_POD=`kubectl get pods -l k8s-app=proxy-agent -n ${KUBE_NS}|sed '1d'|head -1|awk '{print $1}'`
    # View the proxy-agent log.
    kubectl logs ${KUBE_POD} -n ${KUBE_NS}
    7. About one to two minutes after the registration is successful, the agent status becomes Running in the console. In this case, you can manage external clusters in the same way as you manage Kubernetes clusters on the cloud.

    Disassociating Instances

    1. Log in to the TCOP Console, and select Managed Service for Prometheus in the left navigation bar.
    2. On the instance list page, select the name of the instance requiring disassociation to go to the instance details page.
    3. On the Data Collection > Integrate with TKE page, click More > Disassociate in the Operation column at the right side of the table.
    4. In the pop-up dialog, click OK to deassociate it.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support