kubectl exec 执行 容器命令
格式如下:
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 执行 容器命令的更多相关文章
- golang os/exec 执行外部命令
exec包执行外部命令,它将os.StartProcess进行包装使得它更容易映射到stdin和stdout,并且利用pipe连接i/o. func LookPath(file string) (st ...
- PHP 调用 exec 执行中文命令的坑
服务器系统Linux通过php exec 执行rar x 解压命令 保持目录结构,压缩包内英文目录正常解压中文目录解压失败,请问有什么办法可以解决直接在终端命令进行解压是没有问题的 最终解决办法 $s ...
- [go]os/exec执行shell命令
// exec基础使用 import ( "os/exec" ) cmd = exec.Command("C:\\cygwin64\\bin\\bash.exe" ...
- expect中使用exec执行shell命令
今天想在expect脚本中获取本机ip,执行脚本是报错,脚本如下: set localip [exec ifconfig eth0 | grep Mask | cut -d: -f2 | awk '{ ...
- PHP exec/system启动windows应用程序,执行.bat批处理,执行cmd命令
exec 或者 system 都可以调用cmd 的命令 直接上代码: <?php /** 打开windows的计算器 */ exec('start C:WindowsSystem32calc.e ...
- php执行外部命令函数:exec()、passthru()、system()、shell_exec()对比
PHP提供了4种方法执行系统外部命令:exec().passthru().system().shell_exec(),下面分别介绍: 1.exec 原型:string exec ( string $c ...
- Docker容器命令
★根本前提:本地主机有镜像才能创建容器 ⒈docker run [Options] 镜像名称或镜像ID [Command] [Arg...] 用途:利用镜像创建容器实例 Options说明(常用):注 ...
- Kubernetes(k8s)为容器设置启动时要执行的命令和参数
创建 Pod 时设置命令及参数 创建 Pod 时,可以为其下的容器设置启动时要执行的命令及其参数.如果要设置命令,就填写在配置文件的 command 字段下,如果要设置命令的参数,就填写在配置文件的 ...
- php 执行外部命令exec() system() passthru()
php 执行部命令exec() system() passthru() 通常用c写一个外部小程序,然后使用上述命令可以在php中调用 1. exec() string exec ( string $c ...
随机推荐
- Kubernetes 学习15 kubernetes 认证及serviceaccount
一.概述 1.通过此前描述可以知道k8s是以后运行我们生产环境中重要应用程序的尤其是无状态程序的一个非常重要的平台.这里面能托管一些核心应用以及核心数据,很显然对于k8s对应接口的访问不是任何人都可以 ...
- noi.ac #39 MST
MST 模板题 #include <iostream> #include <cstdio> #include <algorithm> #include <cm ...
- 9、共享变量(Broadcast Variable和Accumulator)
一.共享变量 1.共享变量工作原理 Spark一个非常重要的特性就是共享变量. 默认情况下,如果在一个算子的函数中使用到了某个外部的变量,那么这个变量的值会被拷贝到每个task中.此时每个task只能 ...
- shell脚本编程基础之文件测试
文件测试判断条件 -e FILE:测试文件是否存在 -f FILE:测试文件是否为普通文件 -d FILE:测试指定路径是否为目录 -r FILE:测试当前用户对指定文件是否有读权限 -w FILE: ...
- ROS里程计的学习
采用增量式编码器来实现odometry的计算,首先采用编码器对脉冲进行采样实现左右轮运动状态的获取,然后再利用增量式测程法得到机器人车体当前坐标系的位姿. 增量式测量法是使用从编码器采样到的数据并依据 ...
- python 设计模式学习代码记录
@工厂模式class Beijing: def printreslut(self): print("ok") class Shanghai: def printreslut(sel ...
- 软件工程实践2019第五次作业——结对编程的编程实现 version1.1
1.链接 我的博客链接https://github.com/S031402112 结对同学的博客https://www.cnblogs.com/jiabingge/ 我们队创建的仓库的Github项目 ...
- 深度学习面试题14:Dropout(随机失活)
目录 卷积层的dropout 全连接层的dropout Dropout的反向传播 Dropout的反向传播举例 参考资料 在训练过程中,Dropout会让输出中的每个值以概率keep_prob变为原来 ...
- [设计原则与模式] Java 适配器模式
cp from : https://blog.csdn.net/xiaouncle/article/details/80553923 设计模式本质上就是“SOLID设计原则”在实际应用中的具体体现,我 ...
- c++ curl 登陆renren.com (cookie的使用)<转>
size_t write_callback( void *ptr, size_t size, size_t nmemb, void *stream ) { int len = size * nmemb ...