What is the equivalent command for minikube delete
in docker-for-desktop on OSX
As I understand, minikube creates a VM to host its kubernetes cluster but I do not understand how docker-for-desktop is managing this on OSX.
What is the equivalent command for minikube delete
in docker-for-desktop on OSX
As I understand, minikube creates a VM to host its kubernetes cluster but I do not understand how docker-for-desktop is managing this on OSX.
Tear down Kubernetes in Docker for OS X is quite an easy task.
Go to
Preferences
, openReset
tab, and clickReset Kubernetes cluster
.All object that have been created with Kubectl before that will be deleted.
You can also reset docker VM image (
Reset disk image
) and all settings (Reset to factory defaults
) or even uninstall Docker.It's really under the hood in the code. Docker for Mac uses these components: Hyperkit, VPNkit and DataKit
Kubernetes runs in the same Hyperkit VM created for docker and the kube-apiserver is exposed.
You can connect to the VM with this:
Then you can see all the Kubernetes processes in the VM:
So if you uncheck the following box (unclear from the docs what command it uses):
You can see that the processes are removed:
In recent Docker Edge versions for Mac ( 2.1.7 )
Preferences
design has been changed. Now you can reset Kubernetes cluster and other docker aspects by switching to the bug plane in the top right ofPreferences
window:Note: You are able to reset Kubernetes cluster only if it's enabled. If you uncheck "Enable Kubernetes" checkbox, "Reset Kubernetes cluster" button becomes inactive.
For convenience "Reset Kubernetes cluster" is also present on the Kubernetes tab in the main Preferences plane:
Just delete the vm that holds the kubernetes resources.
$ minikube delete
To reset Docker-desktop Kubernetes cluster using command line, put the following content to a file (
dd-reset.sh
) and mark it executable (chmod a+x dd-reset.sh
)Explanation:
This method uses internal scripts from Docker-desktop VM. To make it work, some preparation of user environment is required.
I wasn't able to start Kubernetes cluster using
kube-start.sh
script from inside the VM, so I've used MacOS commands to restart Docker application instead.This method works even if your Kubernetes cluster is not enabled in Docker preferences at the moment, but it's required to enable Kubernetes at least once to use the script.
It was tested on
Docker Edge for MacOS v2.2.2.0 (43066)
There is no guarantee that it will be compatible with earlier or later versions.
This version of Docker uses
kubeadm
to initialize Kubernetes cluster. Scripts are located in the folder/containers/services/docker/rootfs/usr/bin
:kube-pull.sh
(brings kubernetes binaries to VM)kube-reset.sh
(runskube-stop.sh
and dokubeadm reset
+ somerm
stuff)kube-restart.sh
(runskube-stop.sh
andkube-start.sh
)kube-start.sh
(runskube-pull.sh
andkubelet.sh
)kube-stop.sh
(killskubelet
andkube-apiserver
processes, and allk8s
containers)kubeadm-init.sh
(initializes Kubernetes cluster)kubelet.sh
(runskubeadm-init.sh
and startskubelet
binary)Cluster configuration is located in the file
/containers/services/docker/lower/etc/kubeadm/kubeadm.yaml
Resources used: