kubernetes

Kubernetes Basics: Setup a Kubernetes Cluster.

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.

kubernetes

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
kubernetes

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
kubernetes

Once this is complete now we can check if everything is running correctly.

kubernetes

Now we can check nodes running which is only one as we made only one.

kubectl get nodes
kubernetes

Now we can create deployment.

kubectl expose deployment hello-minikube --type=NodePort --port=8080
kubectl get deployments
kubernetes

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
app works

At last we will stop the cluster and delete the minikube instance.

minikube stop
minikube delete --all
delete all nodes

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.

Posts created 29

One thought on “Kubernetes Basics: Setup a Kubernetes Cluster.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top