tencent cloud

Tencent Kubernetes Engine

Release Notes and Announcements
Release Notes
Announcements
Release Notes
Product Introduction
Overview
Strengths
Architecture
Scenarios
Features
Concepts
Native Kubernetes Terms
Common High-Risk Operations
Regions and Availability Zones
Service Regions and Service Providers
Open Source Components
Purchase Guide
Purchase Instructions
Purchase a TKE General Cluster
Purchasing Native Nodes
Purchasing a Super Node
Getting Started
Beginner’s Guide
Quickly Creating a Standard Cluster
Examples
Container Application Deployment Check List
Cluster Configuration
General Cluster Overview
Cluster Management
Network Management
Storage Management
Node Management
GPU Resource Management
Remote Terminals
Application Configuration
Workload Management
Service and Configuration Management
Component and Application Management
Auto Scaling
Container Login Methods
Observability Configuration
Ops Observability
Cost Insights and Optimization
Scheduler Configuration
Scheduling Component Overview
Resource Utilization Optimization Scheduling
Business Priority Assurance Scheduling
QoS Awareness Scheduling
Security and Stability
TKE Security Group Settings
Identity Authentication and Authorization
Application Security
Multi-cluster Management
Planned Upgrade
Backup Center
Cloud Native Service Guide
Cloud Service for etcd
TMP
TKE Serverless Cluster Guide
TKE Registered Cluster Guide
Use Cases
Cluster
Serverless Cluster
Scheduling
Security
Service Deployment
Network
Release
Logs
Monitoring
OPS
Terraform
DevOps
Auto Scaling
Containerization
Microservice
Cost Management
Hybrid Cloud
AI
Troubleshooting
Disk Full
High Workload
Memory Fragmentation
Cluster DNS Troubleshooting
Cluster kube-proxy Troubleshooting
Cluster API Server Inaccessibility Troubleshooting
Service and Ingress Inaccessibility Troubleshooting
Common Service & Ingress Errors and Solutions
Engel Ingres appears in Connechtin Reverside
CLB Ingress Creation Error
Troubleshooting for Pod Network Inaccessibility
Pod Status Exception and Handling
Authorizing Tencent Cloud OPS Team for Troubleshooting
CLB Loopback
API Documentation
History
Introduction
API Category
Making API Requests
Elastic Cluster APIs
Resource Reserved Coupon APIs
Cluster APIs
Third-party Node APIs
Relevant APIs for Addon
Network APIs
Node APIs
Node Pool APIs
TKE Edge Cluster APIs
Cloud Native Monitoring APIs
Scaling group APIs
Super Node APIs
Other APIs
Data Types
Error Codes
TKE API 2022-05-01
FAQs
TKE General Cluster
TKE Serverless Cluster
About OPS
Hidden Danger Handling
About Services
Image Repositories
About Remote Terminals
Event FAQs
Resource Management
Service Agreement
TKE Service Level Agreement
TKE Serverless Service Level Agreement
Contact Us
Glossary

Container coredump Persistence

PDF
Focus Mode
Font Size
Last updated: 2024-12-19 21:49:45

Operation Scenarios

Sometimes, containers may fail to work properly after an exception occurs. If there is no sufficient information in the business log to help you identify the cause, you need to use coredump for further analysis. This document how to generate and save coredump for containers.
Note:
This document only applies to TKE clusters.

Prerequisites

You have logged in to the TKE console.

Directions

Enabling coredump

1. Run the following command on the node to set the storage path format of the core file for the node:
# Run the following command on the node:
echo "/tmp/cores/core.%h.%e.%p.%t" > /proc/sys/kernel/core_pattern
Main parameters are described as follows:
%h: host name (in a Pod, the host name is the Pod name) (recommended).
%e: program file name (recommended).
%p: process ID (optional).
%t: coredump time (optional).
The complete path where the core file is generated is as follows:
/tmp/cores/core.nginx-7855fc5b44-p2rzt.bash.36.1602488967
2. After configuring the node, you need not modify the existing container configuration. The container configuration will automatically take effect through inheritance. If you require batch execution on multiple nodes, perform the corresponding operation accordingly:

Enabling the COS add-on

To prevent the loss of the core file after the container restarts, you need to mount a volume for the container. As the cost of mounting an independent cloud disk for each pod is too high, you need to mount the component to COS. For the directions, see Installing the COS add-on.

Creating a bucket

Log in to the COS console, and manually create a COS bucket for storing the core file generated by the container coredump. In this document, a custom bucket named coredump is created as an example. For directions, see Creating a bucket.

Creating a Secret

You can choose any of the following three methods to create a Secret for accessing COS based on your needs:
To use COS via the console, see Creating a secret that can access COS.
To use COS via a YAML file, see Creating a secret that can access COS.
To create a Secret by using the kubectl command line tool, refer to the following code snippet:
kubectl create secret generic cos-secret -n kube-system --from-literal=SecretId=AKI*****************lV --from-literal=SecretKey=paQ9***************sZF
Note:
Remember to replace SecretId, SecretKey, and namespace.

Creating a PV and PVC

To use the COS plug-in, you need to manually create a PV and PVC and then bind them.

Creating a PV

1. On the details page of the target cluster, choose Storage > PersistentVolume in the left sidebar to go to the "PersistentVolume" page.
2. Click Create to go to the "Create a PersistentVolume" page and set the PV parameters as required, as shown in the figure below:

Main parameters are described as follows:
Creation Method: select Static.
Secret: select the Secret created in Creating a Secret. In this document, coredump is used as an example (under the kube-system namespace).
Bucket List: select the bucket created for storing the coredump file.
Bucket Sub-directory: specify the root directory here. If you need to specify a sub-directory, please create one in the bucket in advance.
3. Click Create a PersistentVolume to complete the process.

Creating a PVC

1. On the details page of the target cluster, choose Storage > PersistentVolumeClaim in the left sidebar to go to the "PersistentVolumeClaim" page.
2. Click Create to go to the "Create a PersistentVolumeClaim" page and set the PVC parameters as required, as shown in the figure below:

Main parameters are described as follows:
Namespace: the namespace must be the same as the namespace where the container of the PVC for mounting COS belongs. If there are multiple namespaces, you can create multiple pairs of PVs and PVCs.
PersistentVolume: select the PV created in Creating a PV.
3. Click Create a PersistentVolumeClaim to complete the process.

Mounting COS

Using the console to create a Pod to use the PVC

Note:
This step creates a Deployment workload as an example.
1. On the details page of the target cluster, choose Workload > Deployment to go to the "Deployment" page.
2. Click Create to go to the "Create a Workload" page. For more information, see Creating a Deployment. Then, mount a volume as required, as shown in the figure below:

Main parameters are described as follows:
Volume: add the PVC created in Creating a PVC.
Mount Target: click Add a mount target to set a mount target. Here, select the added volume "core". Import the PVC specified in Volume, and mount it to the destination path. In this document, /tmp/cores is used as an example.
3. Click Create a Workload to complete the process.

Using a YAML file to create a Pod to use the PVC

You can create a Pod by using a YAML file. Below is a sample:
containers:
- name: pod-cos
command: ["tail", "-f", "/etc/hosts"]
image: "centos:latest"
volumeMounts:
- mountPath: /tmp/cores
name: core
volumes:
- name: core
persistentVolumeClaim:
# Replaced by your pvc name.
claimName: coredump

Reference

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback