Skip to content

Instantly share code, notes, and snippets.

@marcostolosa
Created February 8, 2019 14:07
Show Gist options
  • Save marcostolosa/991e12d147d03adea64a6fe2174b971a to your computer and use it in GitHub Desktop.
Save marcostolosa/991e12d147d03adea64a6fe2174b971a to your computer and use it in GitHub Desktop.
Minikube with KVM - Ubuntu 18.04
#!/bin/bash
# Config: ~/.minikube/machines/minikube/config.json
# kubectl config view
### Installing QEMU/KVM
apt install -y qemu-kvm libvirt-bin virt-top libguestfs-tools virtinst bridge-utils
modprobe vhost_net
lsmod | grep vhost
echo "vhost_net" | tee -a /etc/modules
### Installing Docker
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update && apt install -y docker-ce
usermod -aG docker $(whoami)
docker version
### Installing Minikube
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O /usr/local/bin/minikube
chmod +x /usr/local/bin/minikube
ln -s /usr/local/bin/minikube /usr/bin/minikube
minikube version
### Installing KubeCTL
curl -Lo kubectl 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
mv kubectl /usr/local/bin/
ln -s /usr/local/bin/kubectl /usr/bin/kubectl
kubectl version -o json
### Installing Docker Machine KVM Driver
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
chmod +x docker-machine-driver-kvm2
mv docker-machine-driver-kvm2 /usr/local/bin/
ln -s /usr/local/bin/docker-machine-driver-kvm2 /usr/bin/docker-machine-driver-kvm2
### Starting Minikube
minikube start --vm-driver kvm2
virsh list
kubectl cluster-info
kubectl get nodes
minikube ssh
sudo su -
### Starting Kubernetes Dashboard
minikube addons list
minikube dashboard --url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment