In this series of posts ill cover basics of Kubernetes starting from setting a basic cluster with minikube.
Kubernetes Basics: Installing Kubernetes with minikube.
First of all we will go visit https://kubernetes.io/ to get the latest version of kubectl.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
We can also do it with the command above next well give it execute permissions. Run version command to find the installed version of kubectl.
chmod +x kubectl sudo mv kubectl /usr/local/bin kubectl version
We installed the latest version at the time which is version 1.22.0.
Kubectl can also be installed on windows or mac. From the link I mentioned above you can find appropriate packages for all popular OS’s.
Now we can visit the page minikube get started page. Select the appropriate version of minikube ill use the binary version.
I am using Linux ill select that and we can see the link to the appropriate binary.
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
We have now installed minikube successfully.
We will use virtual box as our virtual machine provider for Kubernetes. Now well install virtual box.
sudo apt-get install virtualbox -y
Once the command is complete we will install virtual box extension package.
sudo apt-get install virtualbox—ext–pack -y
Now we are ready to deploy Kubernetes with virtual box and minikube so we will start the process.
minikube start --driver=virtualbox
Once this is complete now we can check if everything is running correctly.
Now we can check nodes running which is only one as we made only one.
kubectl get nodes
Now we can create deployment.
kubectl expose deployment hello-minikube --type=NodePort --port=8080 kubectl get deployments
Now we can expose service on our deployments and than get URL for the running app.
kubectl expose deployment hello-minikube --type=NodePort --port=8080 minikube service hello-minikube --url curl http://192.168.212.7:31569
At last we will stop the cluster and delete the minikube instance.
minikube stop minikube delete --all
That’s all for Kubernetes basics part 1 next post would be about pods in Kubernetes stay tuned. If you liked the post you might also like Enterprise’s walkthrough as it goes into one of the container breakouts. If you have any specific topics you would like me to cover comment below also try solving Ubotoniam from hack the box if you are excited about Kubernetes security.
One thought on “Kubernetes Basics: Setup a Kubernetes Cluster.”