Execute bash command in pod with kubectl?

后端 未结 2 1212
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 01:55

my question is simple.

How to execute a bash command in the pod? I want to do everything with one bash command?

[root@master ~]# kubectl exec -it --names         


        
2条回答
  •  野的像风
    2021-02-01 02:18

    I use something like this for get into the pod's shell:

    kubectl exec -it --namespace develop pod-name bash
    

    then you can execute the command you want within the pod (e.g. ping)

    ping www.google.com
    

提交回复
热议问题