Created
July 9, 2018 19:53
-
-
Save turkenh/59c644bd110b50382f18db63aa6566bb to your computer and use it in GitHub Desktop.
Kubernetes Pod to debug docker of the Node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: debug-docker | |
spec: | |
nodeSelector: | |
kubernetes.io/hostname: <nodename> | |
containers: | |
- name: dind | |
image: docker:stable | |
args: | |
- sleep | |
- "36000" | |
securityContext: | |
privileged: true | |
volumeMounts: | |
- name: dockerrun | |
mountPath: /var/run/docker.sock | |
terminationGracePeriodSeconds: 30 | |
volumes: | |
- name: dockerrun | |
hostPath: | |
path: /var/run/docker.sock |
To access filesystem of a failed pod:
- Get the node where the pod run:
kubectl get pods -a -o wide
- Exec as above
- Get docker container id:
docker ps -a |grep <some string from pod name>
docker commit <container-id> temp-image
docker run -ti --entrypoint=sh temp-image
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kubectl create -f debug-docker.yaml
kubectl exec -it debug-docker sh