https://github.com/pratikshinde55/k8s-minikube-setup
Create Kubernetes Cluster using Minikube
https://github.com/pratikshinde55/k8s-minikube-setup
Last synced: about 2 months ago
JSON representation
Create Kubernetes Cluster using Minikube
- Host: GitHub
- URL: https://github.com/pratikshinde55/k8s-minikube-setup
- Owner: Pratikshinde55
- Created: 2025-03-16T10:39:26.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-16T11:01:08.000Z (2 months ago)
- Last Synced: 2025-03-16T11:30:20.421Z (2 months ago)
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

**There are many ways to create K8s cluster:**
1. EKS
2. AKS
3. GKE
4. Kubeadm
5. MinikubeHere I use Minikube for Multi-Node Cluster:
Note: The Cluster is creating is automatic by Minikube we just put our requirement but this is not give fully customize option like Kubeadm.## Installation of Minikube & Kubectl on Window:
1. *Minikube install on window:*
- Search on Browser "kubernetes minikube install" and then Click on -> 'latest release'
[Minikube-Download-link](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+downloa)

- After Download Extract exe file then, add **"Path in System Environment variable"**.
- Note: Install Oracle VirtualBox on Window [download-virtualBox-Link](https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html)2. *Now Install Client side/ User side command that is **"kubectl"** for managing K8s Cluster:*
- Search on Browser:-> "kubectl install" -> then click on "Install and Set Up kubectl on Windows"
[kubectl-Download-cmd-Link](https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/#install-kubectl-binary-on-windows-via-direct-download-or-curl)- Note: If CLI show error then put both minikube & kubectl file in same folder of window.
# Single-Node Cluster:
Here i create Single-node cluster that is means on single node Master & Worker Node work done.To Create Single-Node Culster using minikube command is:
minikube start
## Deployment:
- Now create deployment using image:kubectl create deployment myweb --image=pratikshinde55/apache-webserver:v1

- Use describe:
kubectl describe deployment myweb
- Print list of Deployment & Pod:
kubectl get pods
kubectl get deployment
- Get Full lenght information:
kubectl get pods myweb-b77b85fb9-bghs9 -o wide
kubectl get deployment myweb -o wide## Load Balancer: [expose]
- Create service or expose our deployment app to outside world:kubectl expose deployment myweb --type=NodePort --port=80
- Print list of LB:
kubectl get svc
kubectl get service- **Note:** `--type=NodePort` is define give Public_IP & `--port=80` => This is port number of Container or If any app running inside pod/Container then give that port no for example Python-flask app port 5000.
kubectl describe svc myweb- Here, We see all three pods are attached to the Load Balancer, If we Scale-out or Scale-in that will automatic upadte to Load Balancer Service
## Manual Scaling- service: [scale]
- Command for manual scale:kubectl scale deployment myweb --replicas=3
## delete all:
- delete command:kubectl delete all -all
## Delete minikube single-node cluster:
minikube delete
- **Note:** After deleted cluster then Go to windows file manager then go to C:\ then -> Users -> ownuser -> `.minikube` then delete this minikube file
# Multi-Node-Cluster:
Now here create multi-node cluster using minikube.**Interact with Kubernetes:**
1. CLI (Adhoc commands)
2. Code (YAML - Yet Another Markup Language , Declarative Language)
3. API**Start Minikube Multi-node Cluster Command:**
minikube start -n 2 -p pscluster2


**Basic Format of K8s yaml manifest file:** (Use .yml extention for code file)
apiVersion:
kind:
metadata:
name:
labels:
spec:
containers:
- name:
image:## Only Launch Pod without any Deployment or else:
- Create file:
notepad pod.yml
- Describe command:
kubectl describe pods myonlypod
## Replication Controller: [rc]
- When we want to manage desired stage of pods with current stage of pods then we use Replication Controller K8s resource type.
- `replicas` , `selector` , `template` are rc modules/attributes- While launching a pod using rc, we can give labels to pods, We also provides this pod labels to ReplicationController,
So it helps to manage this pods with help of pods labels.
- Check list of rc command:kubectl get rc
- ReplicationController manifest file apply:
notepad rc.yml
kubectl create -f rc.yml
- Describe rc: ( rc --launch--> Pods )
kubectl describe rc myrc

- show lables command:kubectl get pods --show-labels
- selector with show labels:
kubectl get pods --selector team=prod --show-labels

- If we want scale the replicas then we have Three way, 1st is go to yaml offline file add desired replicas and use `kubectl apply` command ,
2nd use `kubectl scale rc myrc --replicas=5` command, & 3rd is `kubectl edit rc myrc` command this gives online edit file to us we just add replicas there.
- get all command show all resources lists which created till now:
kubectl get all
## Kubectl resorces type check and Explain- Show all types resources:
kubectl api-resources

- api versions list:
kubectl api-versions

- Kubectl explain command:
kubectl explain ReplicationController

- use explain cmd with option:
kubectl explain ReplicationController.spec
- more deep explain:
kubectl explain ReplicationController.spec.template

# Minikube dashboard:
- This minikube dashboard command launch GUI dashboard of our cluster on browser:minikube dashboard -p pscluster2

- On Browser:
## Delete all resources & delete cluster:
- Delete all resources in one command:
kubectl delete all --all
- Delete cluster:
minikube delete -p pscluster2
