Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Easily Switch Between Product Types

You can click the drop-down list box to switch between different product types.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Cloud Container Engine/ FAQs/ Workload/ Workload Exception Troubleshooting/ How Can I Locate Faults Using an Exit Code?

How Can I Locate Faults Using an Exit Code?

Updated on 2024-11-13 GMT+08:00

When a container fails to be started or terminated, the exit code is recorded by Kubernetes events to report the cause. This section describes how to locate faults using an exit code.

Viewing an Exit Code

You can use kubectl to connect to the cluster and run the following command to check the pod:

kubectl describe pod {pod name}
In the command output, the Exit Code field indicates the status code of the last program exit. If the value is not 0, the program exits abnormally. You can further analyze the cause through this code.
Containers: 
  container-1: 
    Container ID: ... 
    Image: ... 
    Image ID: ... 
    Ports: ... 
    Host Ports: ... 
    Args: ... 
    State: Running    
      Started: Sat, 28 Jan 2023 09:06:53 +0000 
    Last State: Terminated    
      Reason: Error    
      Exit Code: 255    
      Started: Sat, 28 Jan 2023 09:01:33 +0000    
      Finished: Sat, 28 Jan 2023 09:05:11 +0000 
    Ready: True 
    Restart Count: 1

Description

The exit code ranges from 0 to 255.

  • If the exit code is 0, the container exits normally.
  • Generally, if the abnormal exit is caused by the program, the exit code ranges from 1 to 128. In special scenarios, the exit code ranges from 129 to 255.
  • When a program exits due to external interrupts, the exit code ranges from 129 to 255. When the operating system sends an interrupt signal to the program, the exist code is the interrupt signal value plus 128. For example, if the interrupt signal value of SIGKILL is 9, the exit status code is 137 (9 + 128).
  • If the exist code is not in the range of 0 to 255, for example, exit(-1), the exit code is automatically converted to a value that is within this range.

    If the exist code is a positive number, the conversion formula is as follows:

    code % 256

    If the exit code is a negative number, the conversion formula is as follows:

    256 - (|code| % 256)

For details, see Exit Codes With Special Meanings.

Common Exit Codes

Table 1 Common exit codes

Exit Code

Name

Description

0

Normal exit

The container exits normally. This status code does not always indicate that an exception occurs. When there is no process in the container, it may also be displayed.

1

Common program error

There are many causes for this exception, most of which are caused by the program. You need to further locate the cause through container logs. For example, this error occurs when an x86 image is running on an Arm node.

125

The container is not running.

The possible causes are as follows:

  • An undefined flag is used in the command, for example, docker run --abcd.
  • The user-defined command in the image has insufficient permissions on the local host.
  • The container engine is incompatible with the host OS or hardware.

126

Command calling error

The command called in the image cannot be executed. For example, the file permission is insufficient or the file cannot be executed.

127

The file or directory cannot be found.

The file or directory specified in the image cannot be found.

128

Invalid exit parameter

The container exits but no valid exit code is provided. There are multiple possible causes. You need to further locate the cause. For example, an application running on the containerd node attempts to call the docker command.

137

Immediate termination (SIGKILL)

The program is terminated by the SIGKILL signal. The common causes are as follows:

  • The memory usage of the container in the pod reaches the resource limit. For example, OOM causes cgroup to forcibly stop the container.
  • If OOM occurs, the kernel of the node stops some processes to release the memory. As a result, the container may be terminated.
  • If the container health check fails, kubelet stops the container.
  • Other external processes, such as malicious scripts, forcibly stop the container.

139

Segmentation error (SIGSEGV)

The container receives the SIGSEGV signal from the OS because the container attempts to access an unauthorized memory location.

143

Graceful termination (SIGTERM)

The container is correctly closed as instructed by the host. Generally, this exit code 143 does not require troubleshooting.

255

The exit code is out of range.

The container exit code is out of range. For example, exit(-1) may be used for abnormal exit, and -1 is automatically converted to 255.

Further troubleshooting is required.

Linux Standard Interrupt Signals

You can run the kill -l command to view the signals and corresponding values in the Linux OS.

Table 2 Common Linux standard interrupt signals

Signal

Value

Action

Commit

SIGHUP

1

Term

Sent when the user terminal connection (normal or abnormal) ends.

SIGINT

2

Term

Program termination signal, which is sent by the terminal by pressing Ctrl+C.

SIGQUIT

3

Core

Similar to SIGINT, the exit command is sent by the terminal. Generally, the exit command is controlled by pressing Ctrl+\.

SIGILL

4

Core

Invalid instruction, usually because an error occurs in the executable file.

SIGABRT

6

Core

Signal generated when the abort function is invoked. The process ends abnormally.

SIGFPE

8

Core

A floating-point arithmetic error occurs. Other arithmetic errors such as divisor 0 also occur.

SIGKILL

9

Term

Any process is terminated.

SIGSEGV

11

Core

Attempt to access an unauthorized memory location.

SIGPIPE

13

Term

The pipe is disconnected.

SIGALRM

14

Term

Indicates clock timing.

SIGTERM

15

Term

Process end signal, which is usually the normal exit of the program.

SIGUSR1

10

Term

This is a user-defined signal in applications.

SIGUSR2

12

Term

This is a user-defined signal in applications.

SIGCHLD

17

Ign

This signal is generated when a subprocess ends or is interrupted.

SIGCONT

18

Cont

Resume a stopped process.

SIGSTOP

19

Stop

Suspend the execution of a process.

SIGTSTP

20

Stop

Stop a process.

SIGTTIN

21

Stop

The background process reads the input value from the terminal.

SIGTTOU

22

Stop

The background process reads the output value from the terminal.

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback