
启动集群
minikube start
minikube start --kubernetes-version=latest
minikube stop
minikube delete
minikube delete --all
当你启动了 minikube 后,你可以像操作其他k8s集群一样,通过kubectl 进行集群管理,比如创建一个服务:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8000
kubectl expose deployment hello-minikube1 --type=LoadBalancer --port=8000
minikube service hello-minikube
minikube dashboard
这将会开启 dashboard 插件,并自动在默认浏览器中开启代理的 endpoint,同样,这也需要在终端中保持进程运行,使用Ctrl + C 结束命令后,页面 dashboard 不能继续使用。

获取 dashboard 的URL
如果你不想直接在浏览器中打开代理,也可以执行以下命令,这会只返回可访问的URL地址:
minikube dashboard --url
minikube 的 dashboard,即 Kubernetes 默认的 dashboard,具体可见: dashboard官方文档
minikube 的大多户配置已做成了参数接口,具体可以查看,可以执行以下命令:
minikube start --help

这里展示一部分命令
- Usage:
- minikube start [flags]
-
- Flags:
- --apiserver-name string The apiserver name which is used in the generated certificate for localkube/kubernetes. This can be used if you want to make the apiserver available from outside the machine (default "minikubeCA")
- --container-runtime string The container runtime to be used
- --cpus int Number of CPUs allocated to the minikube VM (default 2)
- --disk-size string Disk size allocated to the minikube VM (format:
[], where unit = b, k, m or g) (default "20g") - --dns-domain string The cluster dns domain name used in the kubernetes cluster
- --docker-env stringArray Environment variables to pass to the Docker daemon. (format: key=value)
- --docker-opt stringArray Specify arbitrary flags to pass to the Docker daemon. (format: key=value)
- --extra-config ExtraOption A set of key=value pairs that describe configuration that may be passed to different components.
- The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.
- Valid components are: kubelet, apiserver, controller-manager, etcd, proxy, scheduler.
- --feature-gates string A set of key=value pairs that describe feature gates for alpha/experimental features.
- --host-only-cidr string The CIDR to be used for the minikube VM (only supported with Virtualbox driver) (default "192.168.99.1/24")
- --hyperv-virtual-switch string The hyperv virtual switch name. Defaults to first found. (only supported with HyperV driver)
- --insecure-registry stringSlice Insecure Docker registries to pass to the Docker daemon
- --iso-url string Location of the minikube iso (default "https://storage.googleapis.com/minikube/iso/minikube-v0.18.0.iso")
- --keep-context This will keep the existing kubectl context and will create a minikube context.
- --kubernetes-version string The kubernetes version that the minikube VM will use (ex: v1.2.3)
- OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64) (default "v1.6.0")
- --kvm-network string The KVM network name. (only supported with KVM driver) (default "default")
- --memory int Amount of RAM allocated to the minikube VM (default 2048)
- --network-plugin string The name of the network plugin
- --registry-mirror stringSlice Registry mirrors to pass to the Docker daemon
- --vm-driver string VM driver is one of: [virtualbox xhyve vmwarefusion] (default "virtualbox")
- --xhyve-disk-driver string The disk driver to use [ahci-hd|virtio-blk] (only supported with xhyve driver) (default "ahci-hd")
-