Setting up Kubernetes on your local machine via minikube and kubectl.
In this tutorial , I will be explaining how we can configure a small kubernetes cluster locally .
Prerequisites :
- docker installed and running
- Ubuntu or any other distro.
- Some knowledge on what Kubernetes is and why its the ‘talk of the town’ nowadays.
- Interest , that’s the most important requirement ;)
Step # 1 : Installing kubectl .
The first step is to install Kubectl , the utility which is used to interact , manage and configure kubernetes clusters .
- Download the binary via curl command :
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
2. After that , make the binary of kubectl executable :
chmod +x ./kubectl
Run that above command where you have downloaded the binary .
3. Now move the binary into your usr/local/bin folder so that it becomes part of your $PATH variable .
sudo mv ./kubectl /usr/local/bin/kubectl
4. And thats it ! Verify it by running
kubectl version --client
If you see the above command , it means your kubectl utility is working fine !
Step # 2: Installing minikube .
Now minikube is used to setup a single node cluster running on your local machine , it is not generally used in production environments . If you just want to have some fun with kubernetes then minikube is your ‘go to guy’ .
- Download the binary via curl :
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
2. Make the binary executable
chmod +x minikube
3. Now install it :
sudo mkdir -p /usr/local/bin/
sudo install minikube /usr/local/bin
4. Now start the minikube service by running :
minikube start --driver=docker
( The driver=docker flag is to tell minikube to spin up its cluster directly on the host machine docker service by creating a virtual machine )
It might take some time to start as its downloading the relevant docker images for it .
You will see output similar to the below screenshot ( i like how they put those emojis ! )
I created a script file that is combining all the above steps in a single script file , just download it and run it as sudo user :)
https://gist.github.com/BilalAM/97f9881e390f9d449f4cf970bdcf3936