The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For a complete list of kubectl operations,
Kubectl is a command line interface for running commands against Kubernetes clusters. kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.
This overview covers kubectl syntax, describes the command operations, and provides common examples. For details about each command, including all the supported flags and subcommands
kubectl get
- List one or more resources.
# List all pods in plain-text output format.
kubectl get pods
# List all pods in plain-text output format and include additional information (such as node name).
kubectl get pods -o wide
# List the replication controller with the specified name in plain-text output format. Tip: You can shorten and replace the 'replicationcontroller' resource type with the alias 'rc'.
kubectl get replicationcontroller <rc-name>
# List all replication controllers and services together in plain-text output format.
kubectl get rc,services
# List all daemon sets, including uninitialized ones, in plain-text output format.
kubectl get ds --include-uninitialized
# List all pods running on node server01
kubectl get pods --field-selector=spec.nodeName=server01
kubectl delete
- Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.
# Delete a pod using the type and name specified in the pod.yaml file.
kubectl delete -f pod.yaml
# Delete all the pods and services that have the label name=<label-name>.
kubectl delete pods,services -l name=<label-name>
# Delete all the pods and services that have the label name=<label-name>, including uninitialized ones.
kubectl delete pods,services -l name=<label-name> --include-uninitialized
# Delete all pods, including uninitialized ones.
kubectl delete pods --all
kubectl exec
- Execute a command against a container in a pod.
# Get output from running 'date' from pod <pod-name>. By default, output is from the first container.
kubectl exec <pod-name> date
# Get output from running 'date' in container <container-name> of pod <pod-name>.
kubectl exec <pod-name> -c <container-name> date
# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.
kubectl exec -ti <pod-name> /bin/bash
相关推荐
rakkess评估访问-kubectl插件以显示所有可用资源的访问矩阵简介您是否想知道提供的kubernetes集群具有什么访问权限? 对于单个资源,您可以使用k rakkess Review Access-kubectl插件显示服务器资源的访问矩阵简介您...
轻松管理所有那些讨厌的二进制文件(kubectl,helm,terraform等)。 binenv您将安装的最后一个二进制文件。 TOC binenv TOC简介快速入门Linux(bash / zsh)MacOS(带bash)Windows安装更新binenv支持的“发行版”...
『Kubernetes简介:包含90个示例的容器管理自动化标准』 ...请注意,必须修改第97页第97页上的kubectl run nginx-app --image nginx --port=80命令,并在kubectl create deployment nginx-app --image nginx 1.18
我的演讲“面向开发人员的Kubernetes简介”的代码 此仓库包含用于我的...kubectl create secret \ docker-registry \ regcred \ --docker-server= < your> \ --docker-username= < your> \ --docker-password=
1. Rancher PaaS平台简介 1 2. Rancher PaaS平台部署 3 2.1. 软硬件环境需求 3 2.1.1. 硬件要求 3 2.1.2. 操作系统要求 4 2.1.3. 软件要求 4 2.1.4. 网络要求 5 2.1.5. 主机名要求 5 2.2. 规划集群拓扑 5 2.2.1. ...
1. Jenkins简介 1 2. Jenkins部署 1 2.1. 软硬件环境需求 1 2.2. Rancher运行 1 2.3. Docker运行 3 2.4. Linux下安装 3 3. Jenkins管理 5 3.1. 全局工具 5 3.1.1. JDK安装配置 5 3.1.2. Maven 安装配置 7 3.1.3. k8s...
内容简介: 1、组件版本和配置策略 2、系统初始化和全局变量 3、创建CA证书和密钥 4、部署kubectl命令行工具 5、部署etcd集群 6、部署flannel网络 7、部署master节点 8、部署woker节点 9、验证集群功能 10、部署集群...
:Helm简介(正在建设中) 参考 Kubernetes kubectl Kubernetes备忘 包括Docker Engine,Docker CLI客户端,Docker Compose,Notary,Kubernetes和Credential Helper。 是一种工具,可在笔记本电脑上的虚拟机(VM)...
简介,为什么要关心CI / CD 什么是CI / CD和Cloud-Native CI / CD Tyk顿 安装 首先,确保你已经安装了在您的环境中,无论你是在本地机器或Kubernetes操场上使用Minikube。 如果您正在使用Kubernetes游乐场,请在标...
Terraform支持有关数字海洋上的微服务,可观察性和混乱的教程 ...Kubectl doctl kubectx 库本斯 头盔3 八进位 刺槐 在custer上安装应用程序和实用程序 指标服务器 网上精品店 洛基 混沌网格 Kubernetes Graph
练习测试-副本集15-部署16-实践-测试-部署17-命名空间18-实践-测试-命名空间19-服务20-服务-ClusterIP 21实践测试服务22个带有Kubectl的命令23个实践测试命令24-附件03-排程01调度部分简介02-手动排程03-实践-...
课程内容: 集群系统简介Kubernetes架构第一个kubectl命令创建一个豆荚创建部署部署自我修复和可伸缩性用yml文件创建一个pod 命令式与声明式方法核心概念应用程序生命周期管理贮存可观察性:记录|监视|跟踪设计...