command-命令 string。 允許的值:apply、create、delete、exec、expose、get、login、logout、logs、run、settop。 選取或指定要執行的 kubectl 命令。 允許的值清單提供一些常見選項,以在使用工作助理時輕鬆選取,但您可以指定其他kubectl 命令,例如scale。 使用arguments輸入,將其他參數指定至指定的kubectl命令。
下面是一个会话的案例:root@my-pod:/app# lsfile1.txt file2.txt file3.txtroot@my-pod:/app# cat file1.txtContents of file1.txtroot@my-pod:/app# ps auxUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.0 1234 567 ? Ss Sep...
当出现应用程序级问题时,检查 pod 日志至关重要。使用kubectl logs <pod-name> -n <namespace>查看给定命名空间中特定 pod 的日志。该命令对于识别应用程序代码中的错误、异常或问题非常有用。 kubectl logsmy-pod -nmy-namespace 在这个例子中: my-pod是要从中获取日志的 pod 的名称。 my-namespace是 pod ...
kubectl exec [-it] POD [-c CONTAINER] -- COMMAND [args...] # 进入某个Pod的容器中 Example: kubectl exec -it nginx -- /bin/bash # 进入名字为nginx的Pod的容器中,并执行/bin/bash命令 kubectl logs [-f] [-p] [-c CONTAINER] POD [-n NAMESPACE] # 查看某个Pod的日志 Example: kubectl ...
$ kubectl [command] [TYPE] [NAME] [flags] 1. commond:指定要对资源执行的操作; 例如: create | get | describe | delete TYPE:指定资源类型,资源类型是大小写敏感的,开发者能够以单数、复数和缩略的形式; 例如: kubectl get pod nginx kubectl get pods nginx ...
kubectl [command] [type] [name] [flags] 1. 参数说明: command:子命令,用于管理和操作Kubernetes集群资源对象的命令。例如:create、delete、describe、get、apply等。 type:资源对象的类型,区分大小写,能以单数形式、复数形式或者简写形式表示。 kubectl get pod pod1 # 单数形式 ...
kubectl [command] [TYPE] [NAME] [flags] 上述语法解释说明: command:指定要对一个或多个资源执行的操作,例如create、get、describe、delete等。 type:指定资源类型。资源类型不区分大小写,可以指定单数、复数或缩写形式。例如,以下命令输出相同的结果: 代码语言:javascript 代码运行次数:0 复制Cloud Studio 代码运行...
(标准输出, 多容器场景) kubectl logs -f my-pod # 流式输出 Pod 的日志(标准输出) kubectl logs -f my-pod -c my-container # 流式输出 Pod 容器的日志(标准输出, 多容器场景) kubectl logs -f -l name=myLabel --all-containers # 流式输出含 name=myLabel 标签的 Pod 的所有日志(标准输出) #...
pods running in thekube-systemnamespace, such as the API server, the DNS server,kube-proxypods, etc. Some clusters have been set up to run those services directly on the control node(s) rather than pods, so in such cases you will need to check the logs directory on the control node(...
out: Execute akubectlcommand Examples getResources putResources putwithawait putwithawaitleveraging check filters putwithawaitcustom conditions getandputResources Source Configuration url:Required. The kubernetes server URL, e.g."https://my-cluster:8443". ...