1. minikube profile
获取或列出当前配置文件(集群)
profile 命令用来设置当前 Minikube 的配置文件,如果没有添加任何参数会获取当前的集群配置文件。
这些配置文件用来运行和管理多集群实例(不同的配置文件对应着不同的 k8s 集群)
你可以通过 minikube profile default
来查看默认的 minikube 配置文件
minikube profile [MINIKUBE_PROFILE_NAME]. You can return to the default minikube profile by running `minikube profile default` [flags]
1.1. 从父命令继承的选项
--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.2. 示例
1.2.1. 查看和修改当前的集群配置文件
查看当前机器上的集群配置文件,有 k8s1 和 k8s1 两个集群的配置文件项
[minikube@localhost ~]$ minikube profile list
|---------|-----------|---------|--------------|------|---------|---------|-------|
| Profile | VM Driver | Runtime | IP | Port | Version | Status | Nodes |
|---------|-----------|---------|--------------|------|---------|---------|-------|
| k8s1 | docker | docker | 192.168.49.2 | 8443 | v1.22.3 | Running | 3 |
| k8s2 | docker | docker | 192.168.58.2 | 8443 | v1.22.3 | Running | 2 |
|---------|-----------|---------|--------------|------|---------|---------|-------|
查看当前配置的集群,并查看对应集群的状态
[minikube@localhost ~]$ minikube profile
k8s1
[minikube@localhost ~]$ minikube status
k8s1
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
k8s1-m02
type: Worker
host: Running
kubelet: Running
k8s1-m03
type: Worker
host: Running
kubelet: Running
设置修改当前的集群配置文件
[minikube@localhost ~]$ minikube profile k8s2
✅ minikube profile was successfully set to k8s2
设置成功后,当前集群的配置文件就是 k8s2 了。
再次查看集群状态就是查看集群 k8s2 配置对应的集群状态了。
[minikube@localhost ~]$ minikube profile
k8s2
[minikube@localhost ~]$ minikube status
k8s2
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
k8s2-m02
type: Worker
host: Running
kubelet: Running