格式如下:
kubectl exec -it podName -c containerName -n namespace -- shell comand 1 创建目录
kubectl exec -it spark-master-xksl -c spark-master -n spark -- mkdir -p /usr/local/spark 注意:
shell命令前,要加-- 号,不然shell命令中的参数,不能识别 实例配置: 查看pod 的 日志 [root@k8s-hd-master03 ~]# kubectl exec -it $(kubectl get pod -n zhiyi-system-test|grep "ai-live-dev"|awk '{print $1}') -n zhiyi-system-test -- tail -f /home/ailive-logs/gray/ailive_dao.2019-05-16.log 2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.getUserPage] <== Total: 5
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.listByExample] ==> Preparing: select a.id, a.user_id, a.team_id, a.streamer_id, a.remark, a.organization, a.created_at, a.updated_at from ( select a.id, a.user_id, a.team_id, a.streamer_id, a.remark, a.organization, a.created_at, a.updated_at from ks_user_remark a WHERE a.team_id = ? and a.streamer_id in ( ? , ? , ? , ? , ? ) order by a.updated_at desc, a.id ) a group by a.streamer_id
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.listByExample] ==> Parameters: 251810(Integer), 50204684(Long), 6646803(Long), 156587032(Long), 188888880(Long), 228158199(Long)
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.listByExample] <== Total: 0
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.listByExample] ==> Preparing: select a.id, a.user_id, a.team_id, a.streamer_id, a.`status`, a.created_at, a.updated_at from ks_user_collect a WHERE a.user_id = ? and a.streamer_id in ( ? , ? , ? , ? , ? ) and a.`status` = ? order by a.updated_at desc
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.listByExample] ==> Parameters: 151810(Integer), 50204684(Long), 6646803(Long), 156587032(Long), 188888880(Long), 228158199(Long), 1(Integer)
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.k.U.listByExample] <== Total: 5
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.t.T.listByCategoryIdList] ==> Preparing: select id, category_id, category_name, parent_cid, parent_category_name, `desc`, `level`, is_leaf, created_at, updated_at from taobao_category_map WHERE category_id in ( ? , ? , ? , ? , ? )
2019-05-16 11:50:53 DEBUG [c.z.a.d.m.t.T.listByCategoryIdList] ==> Parameters: 50013099(Integer), 50010535(Integer), 50016845(Integer), 50018977(Integer), 50010817(Integer)

  

kubectl exec 执行 容器命令的更多相关文章

  1. golang os/exec 执行外部命令

    exec包执行外部命令,它将os.StartProcess进行包装使得它更容易映射到stdin和stdout,并且利用pipe连接i/o. func LookPath(file string) (st ...

  2. PHP 调用 exec 执行中文命令的坑

    服务器系统Linux通过php exec 执行rar x 解压命令 保持目录结构,压缩包内英文目录正常解压中文目录解压失败,请问有什么办法可以解决直接在终端命令进行解压是没有问题的 最终解决办法 $s ...

  3. [go]os/exec执行shell命令

    // exec基础使用 import ( "os/exec" ) cmd = exec.Command("C:\\cygwin64\\bin\\bash.exe" ...

  4. expect中使用exec执行shell命令

    今天想在expect脚本中获取本机ip,执行脚本是报错,脚本如下: set localip [exec ifconfig eth0 | grep Mask | cut -d: -f2 | awk '{ ...

  5. PHP exec/system启动windows应用程序,执行.bat批处理,执行cmd命令

    exec 或者 system 都可以调用cmd 的命令 直接上代码: <?php /** 打开windows的计算器 */ exec('start C:WindowsSystem32calc.e ...

  6. php执行外部命令函数:exec()、passthru()、system()、shell_exec()对比

    PHP提供了4种方法执行系统外部命令:exec().passthru().system().shell_exec(),下面分别介绍: 1.exec 原型:string exec ( string $c ...

  7. Docker容器命令

    ★根本前提:本地主机有镜像才能创建容器 ⒈docker run [Options] 镜像名称或镜像ID [Command] [Arg...] 用途:利用镜像创建容器实例 Options说明(常用):注 ...

  8. Kubernetes(k8s)为容器设置启动时要执行的命令和参数

    创建 Pod 时设置命令及参数 创建 Pod 时,可以为其下的容器设置启动时要执行的命令及其参数.如果要设置命令,就填写在配置文件的 command 字段下,如果要设置命令的参数,就填写在配置文件的 ...

  9. php 执行外部命令exec() system() passthru()

    php 执行部命令exec() system() passthru() 通常用c写一个外部小程序,然后使用上述命令可以在php中调用 1. exec() string exec ( string $c ...

随机推荐

  1. 018_Python3 模块

    在前面的几个章节中我们脚本上是用 python 解释器来编程,如果你从 Python 解释器退出再进入,那么你定义的所有的方法和变量就都消失了. 为此 Python 提供了一个办法,把这些定义存放在文 ...

  2. 1-STM32+W5500+GPRS物联网开发基础篇-工控板简介

    最近这些日子都在忙活STM+W5500+GPRS的板子,所以前面的那块板子的教程耽搁了些时间. 这次的板子和上一版相比更贴近了使用,是因为有朋友督促我要做一块直接可以在工厂使用的板子,所以设计了这一块 ...

  3. test命令用法。功能:检查文件和比较值

    test命令用法.功能:检查文件和比较值 1)判断表达式 if test  (表达式为真) if test !表达式为假 test 表达式1 –a 表达式2                  两个表达 ...

  4. 生活中需要一台mac本子

    用了好多年的windows系统,各种快捷键玩得飞起.当时对mac笔记本的印象就是. mac本子好高大上,搞设计的人才会去用的.(这个也是我听其他人说的) 在当时公司搞IOS开发的人中,面对这个高大上的 ...

  5. D2. Remove the Substring (hard version)(思维 )

    D2. Remove the Substring (hard version) time limit per test 2 seconds memory limit per test 256 mega ...

  6. OpenFOAM制作动画

    原视频下载地址:https://yunpan.cn/cMpfh9cCjKnZI(提取码:823b)

  7. centos下php扩展安装imagemagick

    centos下php扩展安装imagemagick 2015-10-23TONY7PHP 对于php的imagick主要是两部分的安装 ImageMagick主程序地址http://www.image ...

  8. 【一】SpringMVC框架原理

    springmvc基础知识 1.什么是springMVC 2.springMVC框架原理(掌握) 前端控制器.处理器映射器.处理器适配器.视图解析器 3.springmvc入门程序 目的:对前端控制器 ...

  9. mosquitto设置用户名和密码

    https://blog.csdn.net/qq_22111417/article/details/84142509 7.设置用户名和密码 找到用户密码文件在安装bin下: 1: 打开mosquitt ...

  10. git clone时报错“Failed to connect to 127.0.0.1 port 2453: Connection refused”如何处理?

    1. 查看git的配置 git config --global --list| grep -i proxy 如果有内容输出,那么unset配置项,如: git config --global --un ...