DEV Community

Jasper Rodda
Jasper Rodda

Posted on

Deploy pods on Kubernetes Cluster in localhost

Pre-requisites:

Below are essentials before you start deploying containers into kubernetes cluster

  1. Install docker
  2. Install Virtual Box (Type II Hypervisor)
  3. Install Minikube (Kubernetes on local)

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")
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode

Step 1: Create Kubernetes cluster

1.create Mikikube cluster on VirtualBox VM

minikube start --driver=virtualbox
Enter fullscreen mode Exit fullscreen mode

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'.
Enter fullscreen mode Exit fullscreen mode

3.get nodes

PS C:\WINDOWS\system32> kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   13m   v1.27.4
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Top comments (0)