官术网_书友最值得收藏!

Getting help

kubectl has hundreds of different subcommands, options, and arguments. Luckily, kubectl has really good help options. The first one is man pages. If you are using macOS or Linux, you can run the man-f kubectl command to check kubectl-related man pages:

$ man -f kubectl
kubectl(1) - kubectl controls the Kubernetes cluster manager
kubectl-alpha(1), kubectl alpha(1) - Commands for features in alpha
kubectl-alpha-diff(1), kubectl alpha diff(1) - Diff different versions of configurations
...
<output omitted>
...

If for some reason you do not have man pages available on your system, you can just run the kubectl command without any options or arguments. It will show you a list of available subcommands:

$ kubectl
kubectl controls the Kubernetes cluster manager.
Find more information at https://github.com/kubernetes/kubernetes.
Basic Commands (Beginner):
create Create a resource from a file or from stdin.
expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
...
<output omitted>
...
Basic Commands (Intermediate):
get Display one or many resources
explain Documentation of resources
...
<output omitted>
...
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)

The next step is to check the list of available resources by running kubectl <command> or kubectl <command> --help commands, for example, kubectl get:

$ kubectl get
* all
* certificatesigningrequests (aka 'csr')
* clusterrolebindings
...
<output omitted>
...
Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
See 'kubectl get -h' for help and examples.

As you can see, you can also get kubectl get command examples by running kubectl get -h and a detailed resource explanation by running kubectl explain pods. The kubectl command is very easy to navigate and work with.

主站蜘蛛池模板: 龙陵县| 班戈县| 高安市| 天镇县| 桓仁| 双桥区| 巢湖市| 洛南县| 双城市| 安陆市| 昂仁县| 嘉义县| 曲阳县| 丰宁| 广平县| 锡林郭勒盟| 佛教| 南通市| 博兴县| 宁阳县| 峨眉山市| 景宁| 明水县| 永定县| 泰来县| 黎城县| 临汾市| 化隆| 乳源| 大方县| 吉水县| 新巴尔虎右旗| 环江| 郯城县| 特克斯县| 合山市| 利川市| 巴林左旗| 麻阳| 湘乡市| 专栏|