Day 31 : Launching your First Kubernetes Cluster with app.
Today, we will install Kubernetes and will run our first app on it. Let's start.
Task 1 : Install minikube on your local
I have followed this link : https://minikube.sigs.k8s.io/docs/start/
Before anything , make sure you have at least instance with 2 CPU.
we need to run following command on linux .
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
then we will try to start it .
minikube start
if it doesn't then you should configure minicube driver. Make sure you have installed docker ,before configure docker aas driver of minucube.
Now run following command.
minikube start --driver=docker

Now it will start installing Kubernetes in your system.
Congratulation you have installed K8S using minikubes. you can check running pods on your cluster by running following command.
minikube kubectl -- get po -A

Task-02 : Create your first pod on Kubernetes through minikube.
we need to create pod.yml for this . we will use following yml file for it.
apiVersion: v1
kind: Pod
metadata:
name: nodeapp
spec:
containers:
- name: nodeapp
image: patelajay745/node-app-new:latest
ports:
- containerPort: 8000
To run this pod we need following command :
kubectl apply -f pod.yml
but if it gives error of kubctl not found like below screenshot then you have install it.

run this command to install it .
sudo snap install kubectl --classic
Now you can try : kubectl apply -f pod.yml

You will see your nodeapp pod is running.
you can access you app using : http://<minikube-ip>:<nodeapp-port>
That was it for today. If you have any queries/suggestion please write in comment.
See you tomorrow.



