Skip to content

Instantly share code, notes, and snippets.

@aojea
Created June 1, 2025 17:09
Show Gist options
  • Save aojea/faee67fbbcd6197788e69b5c3c417138 to your computer and use it in GitHub Desktop.
Save aojea/faee67fbbcd6197788e69b5c3c417138 to your computer and use it in GitHub Desktop.
ssh pod
# based on https://taozhi.medium.com/the-amazing-chroot-making-simply-ssh-to-each-nodes-in-kubernetes-a3448a665c95
# kubectl exec -it ssh-pod -- chroot /host /bin/bash
apiVersion: v1
kind: Pod
metadata:
name: ssh-pod
labels:
app: ssh-pod
spec:
hostNetwork: true
hostPID: true
hostIPC: true
containers:
- name: ssh-pod
image: busybox:stable
securityContext:
privileged: true
volumeMounts:
- mountPath: /host
name: host
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
volumes:
- name: host
hostPath:
path: /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment