Skip to content

Instantly share code, notes, and snippets.

@aojea
Created September 11, 2023 18:10
Show Gist options
  • Save aojea/d5ff68992478e709e84e60b7e2870371 to your computer and use it in GitHub Desktop.
Save aojea/d5ff68992478e709e84e60b7e2870371 to your computer and use it in GitHub Desktop.
Obtain coredump from an application
kubectl get pods -A -o wide | grep dns
kube-system   kube-dns-5bfd847c64-bkkhf                           4/4     Running   0             80m   10.108.0.5    gke-vanilla-default-pool-ddebe65c-pkzw   <none>           <none>
kubectl debug -n kube-system -it kube-dns-5bfd847c64-bkkhf --image=busybox:1.28 --target=dnsmasq
Targeting container "dnsmasq". If you don't see processes from this container it may be because the container runtime doesn't support this feature.
Defaulting debug container name to debugger-qz6cb.
If you don't see a command prompt, try pressing enter.
/ #
/ # ps axf
PID   USER     TIME  COMMAND
    1 root      0:00 /dnsmasq-nanny -v=2 -logtostderr -configDir=/etc/k8s/dns/dnsmasq-nanny -restartDnsmasq=true -- -k --cache-size=1000 --no-negcache --dns-forward-max=1500 --log-facility=- --server=/cluster.local/127.0.0.1#10053 --server=/in-addr.arpa/127.0.0.1#10053 --server=/ip6.arpa/127.0.0.1#10053 --max-ttl=30 --max-cache-ttl=30
   10 root      0:00 /usr/sbin/dnsmasq -k --cache-size=1000 --no-negcache --dns-forward-max=1500 --log-facility=- --server=/cluster.local/127.0.0.1#10053 --server=/in-addr.arpa/127.0.0.1#10053 --server=/ip6.arpa/127.0.0.1#10053 --max-ttl=30 --max-cache-ttl=30
   12 root      0:00 sh
   18 root      0:00 ps axf
/ #
# ulimit -c
unlimited
mkdir /dumps

on the host

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment