1. minikube config set
在 minikube 配置文件中设置一个单独的值
将 PROPERTY_NAME 配置值设置为 PROPERTY_VALUE ,这些值可以在运行时被标志或环境变量覆盖。
minikube config set PROPERTY_NAME PROPERTY_VALUE [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. 使用 config 管理配置
1.2.2. 设置 driver
1.2.3. 设置 vm-driver
1.2.4. 设置 feature-gates
1.2.5. 设置 v
1.2.6. 设置 cpus
设置集群启动默认的 cpu 数量
[minikube@localhost ~]$ minikube config set cpus 2
❗ These changes will take effect upon a minikube delete and then a minikube start
[minikube@localhost ~]$ minikube config get cpus
2
可等价为 minikube start --cpus='2'
1.2.7. 设置 disk-size
1.2.8. 设置 host-only-cidr
1.2.9. 设置 memory
设置集群启动默认的内存大小
[minikube@localhost ~]$ minikube config set memory 2G
❗ These changes will take effect upon a minikube delete and then a minikube start
[minikube@localhost ~]$ minikube config get memory
2G
可等价为 minikube start --memory='2g'
1.2.10. 设置 log_dir
1.2.11. 设置 kubernetes-version
设置集群启动默认的 kubernetes 版本
[minikube@localhost ~]$ minikube config set kubernetes-version v1.22.3
[minikube@localhost ~]$ minikube config get kubernetes-version
v1.22.3
可等价为 minikube start --kubernetes-version='v1.22.3'
1.2.12. 设置 iso-url
1.2.13. 设置 WantUpdateNotification
1.2.14. 设置 WantBetaUpdateNotification
1.2.15. 设置 ReminderWaitPeriodInHours
1.2.16. 设置 WantNoneDriverWarning
1.2.17. 设置 WantVirtualBoxDriverWarning
1.2.18. 设置 profile
设置默认的集群配置
通过 minikube profile
命令可以看到当前有2个集群配置 k8s1 和 k8s2,而且默认的集群配置是 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
通过 config 来设置 profile 的值
[minikube@localhost ~]$ minikube config set profile k8s2
[minikube@localhost ~]$ minikube config get profile
k8s2
[minikube@localhost ~]$ minikube profile
k8s2
可以看到 minikube profile
和 minikube config set profile
设置的是同一个配置