How do I run a container from the command line in Kubernetes (like docker run)?

前端 未结 2 896
感情败类
感情败类 2021-01-04 05:54

I would like to run a one-off container Pod from the command line in my Kubernetes cluster. I am looking for the equivalent of:

docker run --rm -it centos /b         


        
2条回答
  •  隐瞒了意图╮
    2021-01-04 06:28

    In order to have a Pod created instead of a Deployment and to have it removed by itself when you exit it, try this:

    kubectl run curl-debug --rm -i --tty --restart=Never --image=radial/busyboxplus:curl -- /bin/sh
    

    The --restart=Never flag is what it says to create a Pod instead of a Deployment object

    Also - This image is lightweight, downloads fast and is good for network debugging.

    Hope that helps

提交回复
热议问题