Containers and Pods
Running pods and commands
# kubectl - run command in background
kubectl run nginx-pod --image nginx -- /bin/bash
# oc - run command in background
oc run nginx-pod --image nginx --command -- /bin/bash
# kubectl - run command interactively
kubectl run nginx-pod --image nginx -- /bin/bash
# oc - run command interactively
oc run nginx-pod --image nginx -it --command -- /bin/bash
# oc - run command in background and delete after completion
oc run test-pod --image nginx --rm --restart Never --command -- date
Exec to containers
# exec to pod
oc exec nginx-pod -- /bin/bash
# exec to 1 container in a multi-container pod
oc exec nginx-pod -c ruby-container -- /bin/bash