Skip to content

Instantly share code, notes, and snippets.

@ctron
Last active July 30, 2020 10:02
Show Gist options
  • Save ctron/8667e2d84d59dfb9c1a8447fa8ed4a78 to your computer and use it in GitHub Desktop.
Save ctron/8667e2d84d59dfb9c1a8447fa8ed4a78 to your computer and use it in GitHub Desktop.
Create core dumps with Minikube

Pre-reqs

  • Have minikube running

Prepare Minikube

Log in to the Minikube VM and become root:

minikube ssh
sudo su - root

Set the corefile pattern:

echo "/cores/core.%p" > /proc/sys/kernel/core_pattern

Create the directory:

mkdir /cores

Change your pod/deployment/statefulset

Like so, this only focues on the important parts:

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  volumes:
  - name: cores
    hostPath:
      path: /cores
  containers:
  - name: my-container
    volumeMounts:
    - mountPath: /cores
      name: cores

Get the cores into your host

Logged in to the Minikube VM as root (see above):

chmod a+r /cores/*

Connect to the Minikube VM via SFTP:

sftp -i $(minikube ssh-key)  docker@$(minikube ip)

In the SFTP shell:

cd /cores
ls # list cores
get core.1 # or some other core file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment