Skip to content

Instantly share code, notes, and snippets.

@suhas316380
Last active November 17, 2020 20:00
Show Gist options
  • Save suhas316380/d3026871292dd6d5317c09a1f31d7905 to your computer and use it in GitHub Desktop.
Save suhas316380/d3026871292dd6d5317c09a1f31d7905 to your computer and use it in GitHub Desktop.
kubectl-debug create -f- <<EOF
apiVersion: v1
kind: Pod
metadata:
name: privileged-debug
spec:
hostNetwork: true
containers:
- name: privileged-debug
image: ubuntu
securityContext:
privileged: true
args:
- sleep
- "600"
volumeMounts:
- name: host
mountPath: /host
volumes:
- name: host
hostPath:
path: /
type: Directory
nodeSelector:
kubernetes.io/hostname: ip-your-hostname-here.us-west-2.compute.internal
EOF
kubectl-debug exec --stdin --tty privileged-debug -- /bin/bash
apt update
apt install curl sudo
mkdir /logs
cd /host/home/ec2-user
curl -O https://raw.githubusercontent.com/awslabs/amazon-eks-ami/master/log-collector-script/linux/eks-log-collector.sh
chroot /host bash /home/ec2-user/eks-log-collector.sh
cp /host/var/log/eks_i-1234567_your_log_file_name_here.tar.gz /logs
cd /logs
// optionally exact logs here and read on instance
tar -xzf eks_i-1234567_your_log_file_name_here.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment