kubectl logs帮助信息[root@mcwk8s04 ~]# kubectl logs -hPrint the logs for a container in a pod or specified resource. If the pod has only one container, the container name isoptional.Aliases:logs, logExamples:# Return snapshot logs from pod nginx with only one containerkubectl logs nginx# Return snapshot logs from pod nginx with multi containerskubectl logs nginx --all-containers=true# Return snapshot logs from all containers in pods defined by label app=nginxkubectl logs -lapp=nginx --all-containers=true# Return snapshot of previous terminated ruby container logs from pod web-1kubectl logs -p -c ruby web-1# Begin streaming the logs of the ruby container in pod web-1kubectl logs -f -c ruby web-1# Begin streaming the logs from all containers in pods defined by label app=nginxkubectl logs -f -lapp=nginx --all-containers=true# Display only the most recent 20 lines of output in pod nginxkubectl logs --tail=20 nginx# Show all logs from pod nginx written in the last hourkubectl logs --since=1h nginx# Return snapshot logs from first container of a job named hellokubectl logs job/hello# Return snapshot logs from container nginx-1 of a deployment named nginxkubectl logs deployment/nginx -c nginx-1Options:--all-containers=false: Get all containers' logs in the pod(s).-c, --container='': Print the logs of this container-f, --follow=false: Specify if the logs should be streamed.--ignore-errors=false: If watching / following pod logs, allow for any errors that occur to be non-fatal--limit-bytes=0: Maximum bytes of logs to return. Defaults to no limit.--max-log-requests=5: Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.--pod-running-timeout=20s: The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least onepod is running-p, --previous=false: If true, print the logs for the previous instance of the container in a pod if it exists.-l, --selector='': Selector (label query) to filter on.--since=0s: Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one ofsince-time / since may be used.--since-time='': Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time /since may be used.--tail=-1: Lines of recent log file to display. Defaults to -1 with no selector, showing all log lines otherwise10, if a selector is provided.--timestamps=false: Include timestamps on each line in the log outputUsage:kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER] [options]Use "kubectl options" for a list of global command-line options (applies to all commands).[root@mcwk8s04 ~]# kubectl set 帮助信息[root@mcwk8s03 ~]# kubectl set -hConfigure application resources These commands help you make changes to existing application resources.Available Commands:envUpdate environment variables on a pod templateimageUpdate image of a pod templateresourcesUpdate resource requests/limits on objects with pod templatesselectorSet the selector on a resourceserviceaccount Update ServiceAccount of a resourcesubjectUpdate User, Group or ServiceAccount in a RoleBinding/ClusterRoleBindingUsage:kubectl set SUBCOMMAND [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).[root@mcwk8s03 ~]# kubectl set image帮助信息[root@mcwk8s03 ~]# kubectl set image -hUpdate existing container image(s) of resources. Possible resources include (case insensitive):pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)Examples:# Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1# Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'kubectl set image deployments,rc nginx=nginx:1.9.1 --all# Update image of all containers of daemonset abc to 'nginx:1.9.1'kubectl set image daemonset abc *=nginx:1.9.1# Print result (in yaml format) of updating nginx container image from local file, without hitting the serverkubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yamlOptions:--all=false: Select all resources, including uninitialized ones, in the namespace of the specified resource types--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing inthe template. Only applies to golang and jsonpath output formats.--dry-run=false: If true, only print the object that would be sent, without sending it.-f, --filename=[]: Filename, directory, or URL to files identifying the resource to get from a server.-k, --kustomize='': Process the kustomization directory. This flag can't be used together with -f or -R.--local=false: If true, set image will NOT contact api-server but run locally.-o, --output='': Output format. One of:json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.--record=false: Record current kubectl command in the resource annotation. If set to false, do not record thecommand. If set to true, record the command. If not set, default to updating the existing annotation value only if onealready exists.-R, --recursive=false: Process the directory used in -f, --filename recursively. Useful when you want to managerelated manifests organized within the same directory.-l, --selector='': Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and'!='.(e.g. -l key1=value1,key2=value2)--template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. Thetemplate format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].Usage:kubectl set image (-f FILENAME | TYPE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N[options]Use "kubectl options" for a list of global command-line options (applies to all commands).[root@mcwk8s03 ~]#
经验总结扩展阅读
- 丝绸之路开辟于什么朝代
- 流放之路S20卡兰德之湖赛季上线时间说明
- 2023年7月9日适不适合搬新家
- 回门酒的请帖怎么写 诚邀贵宾之请
- 真正“搞”懂HTTP协议03之时间穿梭
- 网络协议之:redis protocol 详解
- 信号量 C# 多线程访问之 SemaphoreSlim【C# 进阶】
- JavaScript之数组高阶API—reduce
- 奥比岛暗夜袭击第一轮金块失踪之谜通关攻略
- 青蟹为什么那么贵