Deploy pods on Kubernetes Cluster in localhost
Tags: kubernetes, beginners, tutorial, minikube
Published: 2024-01-23 17:34:40

#### Pre-requisites: 
Below are essentials before you start deploying containers into kubernetes cluster
1. Install [docker ](https://docs.docker.com/engine/install/) 
2. Install [Virtual Box (Type II Hypervisor)] (https://www.virtualbox.org/wiki/Downloads)
3. Install [Minikube (Kubernetes on local)] (https://minikube.sigs.k8s.io/docs/start/) 

#### Verify Docker & Minikube installed correctly: 

1. To verify docker type "docker" in powershell and see if you get below options. `PS C:\WINDOWS\system32> docker`
```
PS C:\WINDOWS\system32> docker
Usage:  docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Options:
      --config string      Location of client config files (default
                           "C:\\Users\\Jasper\\.docker")
  -c, --context string     Name of the context to use to connect to the
                           daemon (overrides DOCKER_HOST env var and
                           default context set with "docker context use")
```
2. To verify Minikube, type "minikube" in powershell and see if you get below options. `PS C:\WINDOWS\system32> minikube`
```
PS C:\WINDOWS\system32> minikube
minikube provisions and manages local Kubernetes clusters optimized for development workflows.
Basic Commands:
  start            Starts a local Kubernetes cluster
  status           Gets the status of a local Kubernetes cluster
  stop             Stops a running local Kubernetes cluster
  delete           Deletes a local Kubernetes cluster
```

## Step 1: Create Kubernetes cluster

1.create Mikikube [cluster] (https://minikube.sigs.k8s.io/docs/drivers/virtualbox/) on VirtualBox VM 
```
minikube start --driver=virtualbox
```
2.Get cluster information
```
PS C:\WINDOWS\system32> kubectl cluster-info
Kubernetes control plane is running at https://192.168.XX.XXX:8443
CoreDNS is running at https://192.168.XX.XXX:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
```
3.get nodes
```
PS C:\WINDOWS\system32> kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   13m   v1.27.4
```
4.get namespaces
```
PS C:\WINDOWS\system32> kubectl get namespaces
NAME              STATUS   AGE
default           Active   14m
kube-node-lease   Active   14m
kube-public       Active   14m
kube-system       Active   14m
```
5.get All pods 
```
PS C:\WINDOWS\system32> kubectl get pods -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS      AGE
kube-system   coredns-5d78c9869d-df2qj           1/1     Running   0             14m
kube-system   etcd-minikube                      1/1     Running   0             14m
kube-system   kube-apiserver-minikube            1/1     Running   0             14m
kube-system   kube-controller-manager-minikube   1/1     Running   0             14m
kube-system   kube-proxy-8zw65                   1/1     Running   0             14m
kube-system   kube-scheduler-minikube            1/1     Running   0             14m
kube-system   storage-provisioner                1/1     Running   1 (13m ago)   14m
```