Skip to content

Instantly share code, notes, and snippets.

@tuxerrante
Forked from vfarcic/02-minikube.sh
Last active December 27, 2020 10:31
Show Gist options
  • Save tuxerrante/7714c202e32a47a48619d812f22d90c6 to your computer and use it in GitHub Desktop.
Save tuxerrante/7714c202e32a47a48619d812f22d90c6 to your computer and use it in GitHub Desktop.
#!/bin/bash
function kubectl_version {
kubectl version
kubectl version --output=yaml
}
OS=$(uname -o)
#################
# Only if Linux #
#################
if [[ $OS = "GNU/Linux" ]]; then
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl_version
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
###################
# Only if Windows #
###################
elif [[ $OS = "Msys" ]]; then
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/windows/amd64/kubectl
kubectl_version
#################
# Only if MacOS #
#################
else
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl_version
brew install minikube
fi
############
# Everyone #
############
minikube version
###############################################################################
# You might experience problems with Windows and virtualbox.
# If that's the case, you might want to use hyperv instead. Open a Powershell Admin
# Window and execute the Get-NetAdapter command, noting the name of your network
# connection. Create a hyperv virtual switch:
# > New-VMSwitch -name NonDockerSwitch -NetAdapterName Ethernet -AllowManagementOS $true
# replacing Ethernet with your network connection name. Then create the Minikube vm:
# > minikube start --vm-driver=hyperv --hyperv-virtual-switch "NonDockerSwitch" --memory=4096
minikube start --vm-driver=virtualbox
###############################################################################
minikube status
minikube dashboard
minikube docker-env
eval "$(minikube docker-env)"
docker container ls
minikube ssh
docker container ls
exit
kubectl config current-context
kubectl get nodes
minikube stop
minikube start
minikube delete
minikube start \
--vm-driver=virtualbox \
--kubernetes-version="v1.9.4"
kubectl version --output=yaml
minikube delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment