Skip to content

Instantly share code, notes, and snippets.

@riccardo1980
Created February 14, 2020 21:36
Show Gist options
  • Save riccardo1980/22470d48098c7b6798fa19f61cc6134d to your computer and use it in GitHub Desktop.
Save riccardo1980/22470d48098c7b6798fa19f61cc6134d to your computer and use it in GitHub Desktop.
# Following official howto at:
# https://kubernetes.io/docs/tasks/tools/install-minikube/
set -e
ret=$(sysctl -a | grep -E --color 'machdep.cpu.features' | sed -n 's/.*\(VMX\).*/\1/p')
if [[ $ret == 'VMX' ]]; then
echo 'VT-x feature is enabled'
else
echo 'VT-x feature is NOT enabled'
exit -1
fi
# install kubectl with macports
sudo port selfupdate
sudo port install kubectl-1.16
kubectl version --client
# install minikube with macports
sudo port install minikube
# using virtualbox as hypervisor
minikube start --vm-driver=virtualbox
kubectl cluster-info
# INITIAL TEST
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
kubectl expose deployment hello-minikube --type=NodePort --port=8080
kubectl get pod
# wait until output shows STATUS as Running, then
# get url of the service and use it to connect
minikube service hello-minikube --url
## SERVICE DELETION
kubectl delete services hello-minikube
kubectl delete deployment hello-minikube
## STOP LOCAL CLUSTER
minikube stop
## DELETE LOCAL CLUSTER
minikube delete
## OPTIONAL
# install bash completion
# sudo port install bash-completion
# add suggested startup code to .bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment