How do I see a list of all minikube clusters running in Docker on my mac?

邮差的信 提交于 2021-02-20 08:34:51

问题


I run a Kubernetes cluster on my mac using the latest Docker community edition. I usually do:

$  minikube start --vm-driver=hyperkit

and it works well for me.

Today, I ran that command multiple times in a script. Now, how do I know how many minikube VMs are running on a mac? How do I delete all but one of them? Can I see a list of all minikube vms running?

$ minikube status

shows:

minikube: Running

cluster: Running

kubectl: Correctly Configured: pointing to minikube-vm at 192.168.64.3

Is running minikube start twice not harmful?

I am running minikube version: v0.30.0 on Mac OS High Sierra.

$  kubectl version

shows:

Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.0", 
GitCommit:"0ed33881dc4355495f623c6f22e7dd0b7632b7c0", GitTreeState:"clean", BuildDate:"2018-09-28T15:20:58Z", GoVersion:"go1.11", Compiler:"gc", Platform:"darwin/amd64"}

Thanks for reading.


回答1:


You are using the Hyperkit minikube driver that uses the /usr/local/bin/hyperkit command line (in reality it uses the xhyve Hypervisor). So a simple:

$ ps -Af | grep hyperkit
    0  9445     1   0  1:07PM ttys002    1:45.27 /usr/local/bin/hyperkit -A -u -F /Users/youruser/.minikube/machines/minikube/hyperkit.pid -c 2 -m 2048M -s 0:0,hostbridge -s 31,lpc -s 1:0,virtio-net -U 2caa5ca9-d55c-11e8-92a0-186590def269 -s 2:0,virtio-blk,/Users/youruser/.minikube/machines/minikube/minikube.rawdisk -s 3,ahci-cd,/Users/youruser/.minikube/machines/minikube/boot2docker.iso -s 4,virtio-rnd -l com1,autopty=/Users/youruser/.minikube/machines/minikube/tty,log=/Users/youruser/.minikube/machines/minikube/console-ring -f kexec,/Users/youruser/.minikube/machines/minikube/bzimage,/Users/youruser/.minikube/machines/minikube/initrd,earlyprintk=serial loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=minikube

will tell you how many Hyperkit processes/VMs you are running. AFAIK, minikube only supports one, but you could have another one if you have Docker for Mac installed.

Then if you follow this: How to access the VM created by docker's HyperKit?. You can connect to VM an see what's running inside:

$ sudo screen /Users/youruser/.minikube/machines/minikube/tty
Welcome to minikube
minikube login: root
                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

# docker ps
...  <== shows a bunch of K8s containers


来源:https://stackoverflow.com/questions/53052625/how-do-i-see-a-list-of-all-minikube-clusters-running-in-docker-on-my-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!