1. minikube kubectl
运行 kubernetes 客户端命令 kubectl 来访问集群,并且会自动匹配对应版本的 kubectl,如果 kubectl 命令不存在会自动化下载,通常它会下载一个与主机操作系统和 CPU 架构匹配的二进制文件。
如果由于某些原因(比如不受支持)无法在本地运行 kubectl,可以选择在控制平面上通过 SSH 连接直接运行它,需要注意的是,当使用 --ssh
时,所有路径将基于于远程计算机。
在执行命令时需要在 --
后执行命令,如 minikube kubectl -- get pod
minikube kubectl [flags]
1.1. Options
--ssh Use SSH for running kubernetes client on the node
1.2. 选项
选项 | 默认值 | 描述 | |
---|---|---|---|
--ssh |
- | 使用 SSH 在远程 node 节点上运行 kubernetes client 命令(kubectl) |
1.3. 从父命令继承的选项
--add_dir_header If true, adds the file directory to the header of the log messages
--alsologtostderr log to standard error as well as files
-b, --bootstrapper string The name of the cluster bootstrapper that will set up the Kubernetes cluster. (default "kubeadm")
-h, --help
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log_dir string If non-empty, write log files in this directory
--log_file string If non-empty, use this log file
--log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files
--one_output If true, only write logs to their native severity level (vs also writing to each lower severity level)
-p, --profile string The name of the minikube VM being used. This can be set to allow having multiple instances of minikube independently. (default "minikube")
--skip_headers If true, avoid header prefixes in the log messages
--skip_log_headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
--user string Specifies the user executing the operation. Useful for auditing operations executed by 3rd party tools. Defaults to the operating system username.
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
1.4. 示例
minikube kubectl -- --help
minikube kubectl -- get pods --namespace kube-system