Last active
February 18, 2022 00:35
-
-
Save rms1000watt/d77282e34e433a4eef813762bc359452 to your computer and use it in GitHub Desktop.
Run a Pod in Kubernetes without configuration and exec into it
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Create a container to shell into and run commands from | |
| kubectl run ryan-smith-test --rm -it --restart=Never --image=nginx -- bash | |
| # Create a container that is long lived and will restart | |
| kubectl run test-pod --image nginx | |
| kubectl -it exec test-pod bash | |
| ## run your commands | |
| # exit | |
| kubectl delete pod test-pod | |
| # Create a container that will run & finish | |
| kubectl run pgdatadiff --image davidjmarkey/pgdatadiff:0.2.1 --restart=Never -- /usr/bin/pgdatadiff --firstdb=<uri> --seconddb=<uri2> | |
| kubectl logs pgdatadiff | |
| kubectl delete pod pgdatadiff | |
| # Create DIND | |
| kubectl run ryan-smith-test --rm -it --restart=Never --image=public.ecr.aws/docker/library/docker:dind --privileged -- sh -c "(dockerd-entrypoint.sh &); sh" | |
| unset DOCKER_HOST | |
| docker ps | |
| docker pull hello-world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment