格式如下:
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. php+ tinymce粘贴word

    最近公司做项目需要实现一个功能,在网页富文本编辑器中实现粘贴Word图文的功能. 我们在网站中使用的Web编辑器比较多,都是根据用户需求来选择的.目前还没有固定哪一个编辑器 有时候用的是UEditor ...

  2. RookeyFrame 通用页面 加载数据 原理

    说明: 我是一步一步跳转进去的哈 测试的功能:通用列表页面的普通查询 点一下查询按钮,就能看到请求的地址:/DataAsync/LoadGridData.html 1.DataController - ...

  3. docker使(二)—发布node应用镜像和容器

    应用在本地是已经ok的了,现在将node应用放进docker容器里面 获取node镜像 docker pull node 编写Dokerfile # 根据node镜像开始创建新的镜像(可以加上:tag ...

  4. UOJ449. 【集训队作业2018】喂鸽子 [概率期望,min-max容斥,生成函数]

    UOJ 思路 由于最近养成的不写代码的习惯(其实就是懒),以下式子不保证正确性. 上来我们先甩一个min-max容斥.由于每只鸽子是一样的,这只贡献了\(O(n)\)的复杂度. 现在的问题转化为对于\ ...

  5. 数据结构实验之排序三:bucket sort (SDUT 3400)

    桶排序: #include <stdio.h> #include <string.h> int a[5555555]; int main() { int n,m; scanf( ...

  6. 安装wazuh-agent

    安装wazuh-agent 1. windows 下载地址:https://packages.wazuh.com/3.x/windows/wazuh-agent-3.9.5-1.msi 安装运行 设置 ...

  7. 项目发布到tomcat后,通过项目名称访问报404

    查看tomcat发布地址发现和项目名称不一致 如果直接拷贝项目,可能也需要修改此选项 解决方案: 经过排查发现了原因: 首先说明一下项目 Maven+SSM 需要使用到 maven tomcat 7 ...

  8. vgg16中的函数

    1.inspect.getfile(文件名)文件名一般与类名相同,返回文件目录包含文件名 import inspect class os测试: def __init__(self): path = i ...

  9. springMvc---WebMvcConfigurationSupport

    该类提供了主要的 MVC 配置方法,通过直接继承 WebMvcConfiguration ,并在继承类上 加上 @EnableWebMvc 和 @Configuration 注解之后.便可以在子类中实 ...

  10. [Windows] 输入字符间距变宽

    今天在输入时,不会到误触到哪里,输入的字符间距变得很宽,如下图: 最后找到原因是不小心同时按下了 Shift+Space(空格),进入全角模式,就会导致输入的字符间距变宽 想要恢复,再按一次 shif ...