Skip to content

Instantly share code, notes, and snippets.

@satyamz
Last active April 28, 2024 09:01
Show Gist options
  • Save satyamz/687a3272ed9a645628c4a36b738d3bd7 to your computer and use it in GitHub Desktop.
Save satyamz/687a3272ed9a645628c4a36b738d3bd7 to your computer and use it in GitHub Desktop.
Install Minikube

Minikube installation

Download & install kubectl

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

Stop & Uninstall minikube (if installed previously)

If old minikube version is present is hanging machine on minikube start then do following or jump to next section.

# If old minikube instance is running then delete it.

sudo minikube stop

sudo minikube delete

sudo rm -rf ~/.minikube

Install fresh minikube

# Download minikube
wget https://github.com/kubernetes/minikube/releases/download/v0.24.0/minikube_0.24-0.deb

# Install minikube
sudo dpkg -i minikube_0.24-0.deb

Configure minikube

# Start minikube vm-driver=none option

sudo minikube start --vm-driver=none

# Change permission
sudo chown -R $USER $HOME/.kube
sudo chgrp -R $USER $HOME/.kube
sudo chown -R $USER $HOME/.minikube
sudo chgrp -R $USER $HOME/.minikube

Make sure that minikube is running

$ kubectl get pods --all-namespaces

NAMESPACE     NAME                                     READY     STATUS    RESTARTS   AGE
kube-system   kube-addon-manager-satya-thinkpad-e470   1/1       Running   1          6m

If kube-dns isn't installed by default then try below steps to install. To make sure that kube-dns & kube-dashboard are installed you should get those pods in the above output.

Install kube-dns & kube-dashboard

# Install kube-dns ReplicationController
kubectl apply -f https://raw.githubusercontent.com/kubernetes/minikube/k8s-v1.5/deploy/addons/kube-dns/kube-dns-rc.yaml

# Create service for kube-dns 
kubectl apply -f https://raw.githubusercontent.com/satyamz/minikube/satyamz-invalid-ip-fix/deploy/addons/kube-dns/kube-dns-svc.yaml


# Install kube-dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/minikube/k8s-v1.5/deploy/addons/dashboard/dashboard-rc.yaml

# Create kube-dashboard service 
kubectl apply -f https://raw.githubusercontent.com/kubernetes/minikube/k8s-v1.5/deploy/addons/dashboard/dashboard-svc.yaml

Verify installation

kubectl get pods,svc --all-namespaces

Output should be like:

satya@satya-ThinkPad-E470:~$ kubectl get pods,svc --all-namespaces
NAMESPACE     NAME                                        READY     STATUS    RESTARTS   AGE
kube-system   po/kube-addon-manager-satya-thinkpad-e470   1/1       Running   1          51m
kube-system   po/kube-dns-v20-xrpbq                       3/3       Running   0          34m
kube-system   po/kubernetes-dashboard-6wdtg               1/1       Running   0          32m

NAMESPACE     NAME                       TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE
default       svc/kubernetes             ClusterIP   10.96.0.1        <none>        443/TCP         52m
kube-system   svc/kube-dns               ClusterIP   10.107.134.137   <none>        53/UDP,53/TCP   32m
kube-system   svc/kubernetes-dashboard   NodePort    10.97.166.16     <none>        80:30000/TCP    31m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment