Created
June 27, 2023 15:57
-
-
Save manics/cd085fba6be3806cd6d8d8c482738e0e to your computer and use it in GitHub Desktop.
Access a Kubernetes node root filesystem from a pod
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
# Access a Kubernetes node root filesystem under /mnt/root | |
# Replace nodename.k8s.example.org with the Kubernetes node you want to access | |
# | |
# kubectl apply -f root-host-volume-shell.yaml | |
# kubectl exec -it root-host-volume-shell -- bash | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: root-host-volume-shell | |
spec: | |
nodeSelector: | |
kubernetes.io/hostname: nodename.k8s.example.org | |
containers: | |
- name: root-host-volume-shell | |
command: | |
- sleep | |
args: | |
- 1h | |
image: docker.io/library/busybox:latest | |
imagePullPolicy: IfNotPresent | |
securityContext: | |
privileged: true | |
volumeMounts: | |
- mountPath: /mnt/root | |
name: host-root | |
restartPolicy: Never | |
tolerations: | |
- effect: NoSchedule | |
key: hub.jupyter.org/dedicated | |
operator: Equal | |
value: user | |
- effect: NoSchedule | |
key: hub.jupyter.org_dedicated | |
operator: Equal | |
value: user | |
volumes: | |
- hostPath: | |
path: / | |
type: Directory | |
name: host-root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment