Run an Ubuntu pod interactively, never restart it, and remove it when it exits

kubectl run

  • Run pods in Kubernetes. Specifies pod generator to avoid deprecation error in some K8S versions.
    More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

kubectl run --generator=run-pod/v1 -it temp-ubuntu --image=ubuntu:20.04 --restart=Never --rm -- /bin/bash

click the source code to copy install kubectl run on any operating system with command-not-found.com