kubectl命令使用大全
 
[root@master-test ~]# kubectl --help
kubectl controls the Kubernetes cluster manager. Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/ Basic Commands (Beginner):
create Create a resource from a file or from stdin.
expose 使用 replication controller, service, deployment 或者 pod 并暴露它作为一个 新的
Kubernetes Service
run 在集群中运行一个指定的镜像
set 为 objects 设置一个指定的特征 Basic Commands (Intermediate):
explain 查看资源的文档
get 显示一个或更多 resources
edit 在服务器上编辑一个资源
delete Delete resources by filenames, stdin, resources and names, or by resources and label selector Deploy Commands:
rollout Manage the rollout of a resource
scale Set a new size for a Deployment, ReplicaSet or Replication Controller
autoscale 自动调整一个 Deployment, ReplicaSet, 或者 ReplicationController 的副本数量 Cluster Management Commands:
certificate 修改 certificate 资源.
cluster-info 显示集群信息
top Display Resource (CPU/Memory/Storage) usage.
cordon 标记 node 为 unschedulable
uncordon 标记 node 为 schedulable
drain Drain node in preparation for maintenance
taint 更新一个或者多个 node 上的 taints Troubleshooting and Debugging Commands:
describe 显示一个指定 resource 或者 group 的 resources 详情
logs 输出容器在 pod 中的日志
attach Attach 到一个运行中的 container
exec 在一个 container 中执行一个命令
port-forward Forward one or more local ports to a pod
proxy 运行一个 proxy 到 Kubernetes API server
cp 复制 files 和 directories 到 containers 和从容器中复制 files 和 directories.
auth Inspect authorization Advanced Commands:
diff Diff live version against would-be applied version
apply 通过文件名或标准输入流(stdin)对资源进行配置
patch 使用 strategic merge patch 更新一个资源的 field(s)
replace 通过 filename 或者 stdin替换一个资源
wait Experimental: Wait for a specific condition on one or many resources.
convert 在不同的 API versions 转换配置文件
kustomize Build a kustomization target from a directory or a remote url. Settings Commands:
label 更新在这个资源上的 labels
annotate 更新一个资源的注解
completion Output shell completion code for the specified shell (bash or zsh) Other Commands:
api-resources Print the supported API resources on the server
api-versions Print the supported API versions on the server, in the form of "group/version"
config 修改 kubeconfig 文件
plugin Provides utilities for interacting with plugins.
version 输出 client 和 server 的版本信息 Usage:
kubectl [flags] [options] Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

那么我希望能用kubectl Tab能补全命令需要怎么做呢

 
在centos用户下
# cd ~;echo "source <(kubectl completion bash)" >> .bashrc
# . <(kubectl completion bash)
 
当然,也可以写入到/etc/profile里.退出当前终端,重启进去,以便加载source即可
 

一些实用命令

Q1:当kubectl get po 看到STATUS状态不正常时怎么查找问题?

 [root@master-test ~]# kubectl describe pods nginx-test-97c58fcc-9ncz2

还可以,查看日志

[root@master-test ~]# kubectl logs etcd-master-test -n kube-system

 

kubectl命令小妙招的更多相关文章

  1. 14个Linux系统安全小妙招,总有一招用的上!

    对于互联网IT从业人员来说,越来越多的工作会逐渐转移到Linux系统之上,这一点,无论是开发.运维.测试都应该是深有体会.曾有技术调查网站W3Techs于2018年11月就发布一个调查报告,报告显示L ...

  2. 【CSS】小妙招,各种问题总结方法处理

    1.实现div文字溢出自动省略号截取   overflow:hidden;  /*超过部分不显示*/   text-overflow:ellipsis;  /*超过部分用点点表示*/   white- ...

  3. Angular 开发小妙招1:提交表单数据验证不通过,更改输入组件的样式

    开发表单时,客户端数据完整性校验是必不可少的,在jquery 时代出现了无数的数据验证插件也很好用,开发Angular 应用时,angular 内置了一些常用的数据验证指令.今天要讲的不是这些指令如何 ...

  4. 【转】一个小妙招能让你在服装上省下好多rmb

    朋友们,你们仔细算过自己每年在淘宝上买衣服消费了多少rmb吗?100?1000?10000?甚至更多? 朋友们,你知道淘宝上大多数店铺的衣服是哪里来的吗? 朋友们,你知道怎么在这上面能节省更多的mon ...

  5. MySQL总结小妙招

    mysql5.7版本,免登陆修改管理员密码: vim /etc/my.cnf 加入skip-grant-tables,重启MySQL 终端输入 mysql ,直接登录MySQL数据库,然后use my ...

  6. 这里有40条提升编程技能小妙招!还有TIOBE 7月份的编程语言排行榜

    如何提高编程技能?恐怕很多开发者思考过这个问题.最近,拥有将近 15 年开发经验的软件工程师 Kesk -*- 写了一篇博客,列举了 40 条对其职业生涯有所帮助的事项.   或许,通过以下 40 个 ...

  7. 关于MySQL索引知识与小妙招 — get get get

    一.索引基本知识 1.1 索引的优点 大大减少了服务器需要扫描的数据量,加快数据库的检索速度 帮助服务器避免排序和临时表 将随机io变成顺序io 1.2 索引的用处 速查找匹配WHERE子句的行 从c ...

  8. 下载kaggle数据集的小妙招

    kaggle是很多数据分析和机器学习初学者非常喜爱的数据科学竞赛平台. 这个平台上有很多接近现实业务场景的数据集,非常适合练手. 今天向大家推荐一个下载kaggle数据集的小工具--kaggleAPI ...

  9. 一种比css_scoped和css_module更优雅的避免css命名冲突小妙招

    css_scoped 与 css_module 我们知道,简单的class名称容易造成css命名重复,比如你定义一个class: <style> .main { float: left; ...

随机推荐

  1. Depthwise Separable Convolution(深度可分离卷积)的实现方式

    按照普通卷积-深度卷积-深度可分离卷积的思路总结. depthwise_conv2d来源于深度可分离卷积,如下论文: Xception: Deep Learning with Depthwise Se ...

  2. 使用TiDB把自己写分库分表方案推翻了

    背景 在日益数据量增长的情况下,影响数据库的读写性能,我们一般会有分库分表的方案和使用newSql方案,newSql如TIDB.那么为什么需要使用TiDB呢?有什么情况下才用TiDB呢?解决传统分库分 ...

  3. vue-cli4.x+部署vue2.x开发环境 引入iview

    1.首先当然是安装nodejs,因为这边我已经装过了 所以就不再安装了 直接下一步下一步完成安装. 2.get~安装完成后先测试一下是否在本地已经安装成功了,能出现下面这两个提示就说明安装已经成功了 ...

  4. 基于gis的系统开发,程序运行出现问题 ArcGIS product not specified.You must first bind to an ArcGIS version prior to using any ArcGIS components.

    在之前初始化的时候添加下面的一行代码:ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);还需要添加一个引 ...

  5. makefile实验一 make的基本原则、伪目标、以及不使用.PHONY确实现和伪目标一样功能的一种方法

    target: echo "hello_Makefile" .PHONY: clean clean: echo "clean Done .2019" 使用伪目标 ...

  6. C++ 双冒号开头的语法是什么

    z转载:https://blog.csdn.net/LHHopencv/article/details/78353380 命名空间限定.std::string 表示std命名空间下的 string类. ...

  7. P3118 [USACO15JAN]Moovie Mooving G

    P3118 [USACO15JAN]Moovie Mooving G Link 题目描述 Bessie is out at the movies. Being mischievous as alway ...

  8. WJQ与机房

    sample input 5 6 7 2 3 1 1 5 0 6 0 0 8 6 6 5 3 4 3 7 8 2 4 0 0 6 9 sample output 20 样例解释: 分别以(2,1)为左 ...

  9. VS Code对Golang的基准测试研究

    初心 想要在VS Code比较方便的调试Go代码的性能,了解到基准测试对此很有帮助,但默认VS Code执行 Go 的基准测试默认的benchtime为1秒,但测试性能时需要设置为更多秒 办法 在VS ...

  10. 多测师讲解接口测试_F12中network里headers各项属性的含义——高级讲师肖sir

    General部分: Request URL:资源的请求url # Request Method:HTTP方法  Status Code:响应状态码  200(状态码) OK 301 - 资源(网页等 ...