格式如下:
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. YAML_12 批量创建用户,分别设置用户组

    with_items标准循环 ansible]# vim add.yml --- - hosts: web2   remote_user: root   tasks:     - user:     ...

  2. ES特点

    ES                     Hadoop                       spark的区别存(可扩展)         hdfs存(可扩展)             不存 ...

  3. 深入基础(四)Buffer,转码

    Buffer     前面提及到一些关于buffer类的问题,当时不是很明确 那么就次机会顺便深入探讨一下这个东西到底干嘛的出现在什么时候,如何使用.昨天跟朋友聊天他说我每一篇博文内容太长太长了 虽然 ...

  4. Subspace Subcode

    子码(subcode)的概念来自信息编码,不太容易理解.通常是子域编码(subfield subcode),也可以扩展到子空间编码(subspace subcode). 子空间或者子域编码的一个基本想 ...

  5. 1071 Speech Patterns (25)(25 分)

    People often have a preference among synonyms of the same word. For example, some may prefer "t ...

  6. SpringMVC+Spring+Mybatis简单总结

    SpringMVC+Spring+Mybatis总结 第一部分:分析 web.xml中的配置 SSM框架的整合其实是Spring和SpringMVC的整合以及Spring和Mybatis进行整合. 当 ...

  7. 读取本地word 浏览器下载(设置编码格式)

    String filePath = "C:\\word\\报告.doc"; BufferedWriter bos = null; BufferedReader bis = null ...

  8. Django框架,python2和python3共存的情况下,创建Django项目

    一.python2和python3共存的情况下,直接使用 django-admin startproject Django-project 这个时候系统默认使用的是python2创建,可能由于pyth ...

  9. 【微信小程序】scroll-view 的上拉加载和下拉刷新

    1.在微信小程序中,想到 下拉刷新 和 上拉加载,如果是整个页面都拖动的话,可以在页面配置中,配置 enablePullDownRefresh 和 onReachBottomDistance 然后在 ...

  10. HTML5中的article和section的区别

    HTML5中的article和section的区别 一.总结 一句话总结: article和section都相当于语义化后的div,article强调独立性,section强调分段或者分块 1.art ...