K8s-coredump handler: Coredump is not created when using capital G in "core_max_size: 5G" for pod mounted to a PVC
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
StarlingX |
In Progress
|
Undecided
|
Unassigned |
Bug Description
Brief Description
-----------------
It was noticed that for a pod mounted to PVC, pod coredump is not been generated if 'starlingx.
Likely applied to another size annotations. This needs to be validated too.
Severity
--------
Minor
Steps to Reproduce
------------------
Create YAML definitions for PVC and POD:
// pvc-definition.yaml
kind: PersistentVolum
apiVersion: v1
metadata:
name: pvc-claim1
spec:
storageClassName: general
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
// pod (make sure core_max_size annotation is using capital G):
apiVersion: v1
kind: Pod
metadata:
name: ubuntu-
annotations:
starlingx.
starlingx.
starlingx.
starlingx.
starlingx.
spec:
containers:
- name: ubuntu-
image: ubuntu
command: ["/bin/bash", "-ec", "while :; do echo '.'; sleep 5 ; done"]
volumeMounts:
- name: pvc
mountPath: "/coredump-log"
restartPolicy: "Never"
volumes:
- name: pvc
persistentV
claimName: pvc-claim1
Deploy the PVC and POD
$ kubectl create -f pvc-definition.yaml
persistentvolum
$ kubectl create -f ubuntu-pod.yaml
pod/ubuntu-
Connect to the pod to kill the application
Note: In our case, the pod was created to run sleep process:
command: ["/bin/bash", "-ec", "while :; do echo '.'; sleep 5 ; done"]
// Connect to the pod
$ kubectl exec -it ubuntu-
// Check the coredump-log folder has been created:
# ls -ltr | grep core
drwxr-xr-x 3 root root 4096 Sep 29 20:22 coredump-log
// Move to the directory
# cd coredump-log
// Kill the application running on pod
# kill -s 5 $(pgrep sleep)
// Pod will be in Error state:
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
ubuntu-
Redeploy the pod to check coredump
// First, delete the pod in Error state
$ kubectl delete pod ubuntu-
// Deploy again
$ kubectl create -f ubuntu-pod.yaml
// Connect to the pod and check coredump has been generated
$ kubectl exec -it ubuntu-
// See that no coredump has been generated
# ls coredump-log
lost+found
#
Expected Behavior
------------------
Coredump generated using either lowercase or uppercase for 'core_max_size' annotation.
Actual Behavior
----------------
Coredump is NOT generated when using uppercase G, e.g., 'starlingx.
Reproducibility
---------------
Intermittent
System Configuration
-------
DX+
Timestamp/Logs
--------------
INFO:k8s-
INFO:k8s-
INFO:k8s-
INFO:k8s-
INFO:k8s-
DEBUG:k8s-
INFO:k8s-
DEBUG:nsenter:
INFO:k8s-
INFO:k8s-
DEBUG:nsenter:
INFO:k8s-
DEBUG:k8s-
INFO:k8s-
INFO:k8s-
Test Activity
-------------
Testing
Workaround
----------
Use lowercase 'g':
starlingx.
Changed in starlingx: | |
status: | New → In Progress |
Reviewed: https:/ /review. opendev. org/c/starlingx /utilities/ +/902153 /opendev. org/starlingx/ utilities/ commit/ a9710363943c805 f5f874bb3097386 539d95e061
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit a9710363943c805 f5f874bb3097386 539d95e061
Author: Heron Vieira <email address hidden>
Date: Wed Nov 29 11:38:14 2023 -0300
Improve logs and case-sensitive on k8s-coredump
Improving logging by adding timestamp and
show error in case we have a KeyError while
trying to verify configurations set by
pod annotations.
Also allowing case-sensitive paths to be
configured as the path to save the coredumps.
PASS: AIO-SX install and bootstrap.
successful ly.
successful ly.
successful ly.
successful ly using a PVC setup.
PASS: On a AIO-SX test if k8s-coredump is executed
PASS: On a AIO-DX test if k8s-coredump is executed
PASS: On a Standard test if k8s-coredump is executed
PASS: On a Standard test if k8s-coredump is executed
Partial-Bug: 2045789
Change-Id: I942253468a596b 7d68d6a3733b240 62cfb4661f7
Signed-off-by: Heron Vieira <email address hidden>