wlzx059@node01:~$ kubectl get --help
Display one or many resources.(显示一个或多个资源。)Prints a table of the most important information about the specified resources. You can filter the list using a label
selector and the --selector flag.If the desired resource type is namespaced you will only see results in your current
namespace unless you pass --all-namespaces.(打印有关指定资源的最重要信息的表。您可以使用标签选择器和 --selector 标志过滤列表。如果所需的资源类型已命名,则除非传递 --all-namespaces,否则您将只能在当前命名空间中看到结果。
)By specifying the output as 'template' and providing a Go template as the value of the --template flag, you can filter
the attributes of the fetched resources.(通过将输出指定为“template”并提供 Go 模板作为 --template 标志的值,您可以过滤获取的资源的属性。)
Use "kubectl api-resources"for a complete list of supported resources.Examples:# List all pods in ps output format (以 ps 输出格式列出所有 pod)kubectl get pods# List all pods in ps output format with more information (such as node name)(以 ps 输出格式列出所有 pod,并提供更多信息(例如节点名称))kubectl get pods -o wide# List a single replication controller with specified NAME in ps output format(List a single replication controller with specified NAME in ps output format)(以 ps 输出格式列出具有指定 NAME 的单个复制控制器)kubectl get replicationcontroller web# List deployments in JSON output format, in the "v1" version of the "apps" API group(在“应用”API 组的“v1”版本中以 JSON 输出格式列出部署)kubectl get deployments.v1.apps -o json# List a single pod in JSON output format(以 JSON 输出格式列出单个 Pod)kubectl get -o json pod web-pod-13je7# List a pod identified by type and name specified in "pod.yaml" in JSON output format(列出由 JSON 输出格式的“pod.yaml”中指定的类型和名称标识的 pod)kubectl get -f pod.yaml -o json# List resources from a directory with kustomization.yaml - e.g. dir/kustomization.yaml(使用 kustomization.yaml 列出目录中的资源 - 例如 dir/kustomization.yaml)kubectl get -k dir/# Return only the phase value of the specified pod(仅返回指定 Pod 的相位值)kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}# List resource information in custom columns(在自定义列中列出资源信息)kubectl get pod test-pod-o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image# List all replication controllers and services together in ps output format(以 ps 输出格式一起列出所有复制控制器和服务)kubectl get rc,services# List one or more resources by their type and names(按类型和名称列出一个或多个资源)kubectl get rc/web service/frontend pods/web-pod-13je7# List status subresource for a single pod.(列出单个pod的状态子资源)kubectl get pod web-pod-13je7 --subresource statusOptions:-A,--all-namespaces=false:If present, list the requested object(s) across all namespaces. Namespace in current context is ignored evenif specified with --namespace.(如果存在,请列出所有命名空间中请求的对象。当前上下文中的命名空间将被忽略,即使使用 --namespace 指定也是如此。)--allow-missing-template-keys=true:If true, ignore any errors in templates when a field or map key is missing in the template. Only applies togolang and jsonpath output formats.(如果为 true,则当模板中缺少字段或映射键时,忽略模板中的任何错误。仅适用于 golang 和 jsonpath 输出格式。)--chunk-size=500:Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change inthe future.(以块的形式返回大型列表,而不是一次返回所有列表。传递 0 表示禁用。此标志是测试版,将来可能会更改。)--field-selector='':Selector (field query) to filter on, supports '=','==', and '!='.(e.g.--field-selectorkey1=value1,key2=value2). The server only supports a limited number of field queries per type.(要筛选的选择器(字段查询)支持“=”、“==”和“!=”。(例如 --字段选择器键 1=值 1,键 2=值 2)。服务器仅支持每种类型的有限数量的字段查询。)-f,--filename=[]:Filename, directory, or URL to files identifying the resource to get from a server.(文件名、目录或文件的 URL,用于标识要从服务器获取的资源。)--ignore-not-found=false:If the requested object does not exist the command will returnexit code 0.(如果请求的对象不存在,则该命令将返回退出代码 0)-k,--kustomize='':Process the kustomization directory. This flag can't be used together with -f or -R.(处理库托化目录。此标志不能与 -f 或 -R 一起使用。)-L, --label-columns=[]:Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive.You can also use multiple flag options like -L label1 -L label2...(接受将以逗号分隔的标签列表,这些标签将显示为列。名称区分大小写。您还可以使用多个标志选项,例如 -L 标签 1 -L 标签 2...)--no-headers=false:When using the default or custom-column output format, don't print headers (default print headers).(使用默认或自定义列输出格式时,请勿打印标题(默认打印标题)。)-o,--output='':Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath,jsonpath-as-json, jsonpath-file, custom-columns, custom-columns-file, wide). See custom columns[https://kubernetes.io/docs/reference/kubectl/#custom-columns], golang template[http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template[https://kubernetes.io/docs/reference/kubectl/jsonpath/].(输出格式)--output-watch-events=false:Output watch event objects when --watch or --watch-only is used. Existing objects are output as initial ADDEDevents.(使用 --watch 或 --仅监视时输出监视事件对象。现有对象作为初始 ADD 事件输出。)--raw='':Raw URI to request from the server. Uses the transport specified by the kubeconfig file.(要从服务器请求的原始 URI。使用 kubeconfig 文件指定的传输。)-R,--recursive=false:Process the directory used in -f,--filename recursively. Useful when you want to manage related manifestsorganized within the same directory.(递归处理 -f, --文件名中使用的目录。当您想要管理在同一目录中组织的相关清单时很有用。)-l,--selector='':Selector (label query) to filter on, supports '=','==', and '!='.(e.g.-l key1=value1,key2=value2). Matchingobjects must satisfy all of the specified label constraints.(要筛选的选择器(标签查询)支持“=”、“==”和“!=”。(例如 -l 键 1=值 1,键 2=值 2))--server-print=true:If true, have the server return the appropriate table output. Supports extension APIs and CRDs.(如果为 true,则让服务器返回相应的表输出。支持扩展 API 和 CRD。)--show-kind=false:If present, list the resource typefor the requested object(s).(如果存在,请列出所请求对象的资源类型。)--show-labels=false:When printing, show all labels as the last column (default hide labels column)(打印时,将所有标签显示为最后一列(默认隐藏标签列))--show-managed-fields=false:If true, keep the managedFields when printing objects in JSON or YAML format.(如果为 true,则在以 JSON 或 YAML 格式打印对象时保留托管字段。)--sort-by='':If non-empty,sort list types using this field specification. The field specification is expressed as aJSONPath expression (e.g.'{.metadata.name}'). The field in the API resource specified by this JSONPathexpression must be an integer or a string.(如果非空,则使用此字段规范对列表类型进行排序。字段规范表示为 JSONPath 表达式(例如 '{.metadata.name}')。此 JSONPath 表达式指定的 API 资源中的字段必须是整数或字符串。)--subresource='':If specified, gets the subresource of the requested object. Must be one of [status scale]. This flag is betaand may change in the future.(如果指定,则获取请求对象的子资源。必须是[状态等级]之一。此标志是测试版,将来可能会更改。)--template='':Template string or path to template file to use when -o=go-template,-o=go-template-file. The template formatis golang templates [http://golang.org/pkg/text/template/#pkg-overview].(模板字符串或模板文件的路径,当 -o=go-template, -o=go-template-file 时使用。模板格式为golang模板)-w,--watch=false:After listing/getting the requested object, watch for changes.(列出/获取请求的对象后,观察更改。如果未提供对象名称,则排除未初始化的对象。)--watch-only=false:Watch for changes to the requested object(s), without listing/getting first.(监视对请求对象的更改,而无需列出/获取第一个。)Usage:kubectl get
[(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide](TYPE[.VERSION][.GROUP][NAME | -l label]|TYPE[.VERSION][.GROUP]/NAME ...)[flags][options]Use "kubectl options"for a list of global command-line options (applies to all commands).