Last active
June 7, 2019 12:32
-
-
Save hakuno/f57731677c70f7d23b37a190da98d150 to your computer and use it in GitHub Desktop.
Fedora Minikube Setup & Start with KVM2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if ! [ -x "$(command -v docker)" ] | |
then | |
echo "⛔ Oh, my Gosh! You don't even have Docker on it." | |
exit 1; | |
else | |
sudo systemctl start docker | |
fi | |
if [ "$(egrep --color 'vmx|svm' /proc/cpuinfo)" == "" ] | |
then | |
echo "⛔ VT-x or AMD-v virtualization must be enabled in your computer's BIOS."; | |
exit 1; | |
fi | |
if ! [ -x "$(command -v virsh)" ] | |
then | |
sudo dnf -y install bridge-utils libvirt virt-install qemu-kvm | |
sudo usermod -a -G libvirt $(whoami) | |
sudo systemctl start libvirtd | |
else | |
sudo systemctl start libvirtd | |
fi | |
if ! [ -x "$(command -v kubectl)" ] | |
then | |
{ | |
echo '[kubernetes]' | |
echo 'name=Kubernetes' | |
echo 'baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64' | |
echo 'enabled=1' | |
echo 'gpgcheck=1' | |
echo 'repo_gpgcheck=1' | |
echo 'gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg' | |
} >> /etc/yum.repos.d/kubernetes.repo | |
dnf check-update | |
dnf install -y kubectl | |
fi | |
if [ -x "$(command -v minikube)" ]; then | |
minikube delete | |
fi | |
touch minikube.lock | |
today=$(date +%F) | |
last_update=$(cat minikube.lock) | |
if [ "${today}" == "${last_update}" ] | |
then | |
echo "✨ Already updated on ${today}..." | |
else | |
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | |
sudo install minikube /usr/local/bin/ | |
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 | |
sudo install docker-machine-driver-kvm2 /usr/local/bin/ | |
echo $(date +%F) > minikube.lock | |
fi | |
minikube config set vm-driver kvm2 | |
minikube start --vm-driver kvm2 | |
kubectl config use-context minikube | |
eval $(minikube docker-env) | |
if ! [ -x "$(command -v helm)" ] | |
then | |
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh | |
chmod 700 get_helm.sh | |
./get_helm.sh | |
helm init --history-max 200 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment