Difference between revisions of "K8s Create Ubuntu Utility Container"
Jump to navigation
Jump to search
(Created page with "You can easily create a utility container with the following commands ``` kubectl run ubuntu --image=ubuntu -- sleep 3600 ``` ``` echo test > test.txt kubectl cp test.txt ub...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
You can easily create a utility container with the following commands | You can easily create a utility container with the following commands | ||
+ | refresh every hour | ||
``` | ``` | ||
kubectl run ubuntu --image=ubuntu -- sleep 3600 | kubectl run ubuntu --image=ubuntu -- sleep 3600 | ||
``` | ``` | ||
+ | indefinitely until stopped | ||
``` | ``` | ||
− | + | kubectl run ubuntu --image=ubuntu -- bash -c "while true; do sleep 3600; done" | |
− | kubectl | ||
``` | ``` | ||
``` | ``` | ||
kubectl exec -it ubuntu -- bash | kubectl exec -it ubuntu -- bash | ||
+ | apt update && apt install -y vim postgresql-client | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
+ | echo test > test.txt | ||
+ | kubectl cp test.txt ubuntu:/ | ||
``` | ``` | ||
Latest revision as of 18:47, 12 October 2021
You can easily create a utility container with the following commands
refresh every hour
kubectl run ubuntu --image=ubuntu -- sleep 3600
indefinitely until stopped
kubectl run ubuntu --image=ubuntu -- bash -c "while true; do sleep 3600; done"
kubectl exec -it ubuntu -- bash apt update && apt install -y vim postgresql-client
echo test > test.txt kubectl cp test.txt ubuntu:/
cat test.txt apt update apt install pgloader postgresql-client
To remove
kubectl delete pod ubuntu