Updated on 2025-04-03 GMT+08:00

Configuring Core Dump

Scenario

Before creating or updating a pod, you can use the system.cci.io/coredump annotation to set the core_pattern of the kernel, so that you can use generated core dump files to locate the cause of the pod failure.

How to Use

When creating a pod, the core dump configuration (system.cci.io/coredump : '{"core_pattern": "/var/cores/core.%h.%e.%p.%t," max_size": 2048}') can be added to the annotations field. If the maximum size is not specified, the default value is 1024. Core dump will be used in the pod.

Constraints

  • The value of the system.cci.io/core_pattern field in the request must start with /var/, and the file path cannot contain vertical bars (|).
  • The configured path must exist in the container. You are advised to mount volumes to store core dump files persistently.

Creating a Pod Using ccictl

You can add an annotation to the workload to control whether to enable core dump for a pod.

apiVersion: cci/v2
kind: Deployment
metadata:
  annotations:
    description: ''
  labels: {}
  name: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      annotations:
        vm.cci.io/pod-size-specs: 2.00_4.0
        resource.cci.io/pod-size-specs: 2.00_4.0
        metrics.alpha.kubernetes.io/custom-endpoints: '[{api:'''',path:'''',port:'''',names:''''}]'
        system.cci.io/coredump: "{\"core_pattern\": \"/var/cores/core.%h.%e.%p.%t\",\"max_size\": 1024}"    # Enable core dump.
        log.stdoutcollection.kubernetes.io: '{"collectionContainers": ["container-0"]}'
      labels:
        app: nginx
    spec:
      containers:
        - image: library/nginx:stable-alpine-perl
          name: container-0
          resources:
            limits:
              cpu: 2000m
              memory: 4096Mi
            requests:
              cpu: 2000m
              memory: 4096Mi
          command: []
          lifecycle: {}
      dnsPolicy: ''
      imagePullSecrets:
        - name: imagepull-secret
      dnsConfig: {}
  minReadySeconds: 0
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1

system.cci.io/coredump indicates that core dump will be configured for the pod.