Getting Started with Minikube Kubernetes
Tags: kubernetes, todayilearned, beginners, microservices
Published: 2021-05-30 14:00:17

How to run local Kubernetes clusters?

### What is Minkube?

Minikube is local Kubernetes, concentrating on delivering an easy to learn and develop the infrastructure for Kubernetes.

It runs a single node cluster on your local computer.

### Before getting started

Check the system virtualization configuration. To validate virtualization support on Windows 8 and above, run the subsequent command on your Windows terminal or command prompt.

    systeminfo

If you recognize the following output, virtualization is supported on Windows.

    Hyper-V Requirements:     VM Monitor Mode Extensions: Yes
                              Virtualization Enabled In Firmware: Yes
                              Second Level Address Translation: Yes
                              Data Execution Prevention Available: Yes

If you recognize the following output, the system already has a Hypervisor established.

    Hyper-V Requirements:     A hypervisor has been detected. Features required for Hyper-V will not be displayed.

### Prerequisites

* Install kubectl if not installed already. [Link](https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/windows/amd64/kubectl.exe)

* Install a hypervisor if not installed already. [Hyper-V](https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/quick_start/walkthrough_install) or [VirtualBox](https://www.virtualbox.org/wiki/Downloads)

### Minimum System specifications

 <iframe src="https://medium.com/media/b440f0bf955a5a173288660949dda6bb" frameborder=0></iframe>

### Start Minikube

After completion of the required prerequisites, kindly run the below command to start Minikube on a single node cluster locally.

**NOTE: Run Command Prompt in Administrator Mode.**

    minikube start --driver=<DriverName>

    Example
    minikube start --driver=hyperv

The above command will need some time to finish all the necessary configurations.

### Verify Minikube

Once minikube start ends, run the command below to check the status of the cluster. Refer below the screenshot to check the output.

    minikube status

![](https://cdn-images-1.medium.com/max/2000/1*HMSBfuRTcxYASgJ7Sxhrdw.png)

### Stop Minikube

To stop the local Minikube Kubernetes cluster, run:

    minikube stop

![](https://cdn-images-1.medium.com/max/2000/1*7tKkTSDxvpJTLmIO4fW4Sw.png)

Notice the above command outputs “1 node stopped” it confirms that Minkube runs on a single-node Kubernetes cluster.

### Troubleshoot

If minikube start throws an error means may be local state cleanup is required. Run the following command to clean the state:

    minikube delete

After this try minikube start.
> # Let’s understand how to deploy an image on a local Kubernetes cluster using kubectl & minikube.

### Deploy an image on Kubernetes

Using an existing image named echoserver using kubectl command to deploy an existing image on the local cluster:

    kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10

The console output is similar to this:

    deployment.apps/hello-minikube created

### Access Minikube Deployment

Expose it as a Service:

    kubectl expose deployment hello-minikube --type=NodePort --port=8080

The option --type=NodePort specifies the type of Service.

The console output is similar to this:

    service/hello-minikube exposed

### Check container status

As we have just created the Service, need to wait until the Pod is up and running:

    kubectl get pod

If the output shows the STATUS as ContainerCreating, it’s being created. The result is similar to this:

    NAME             READY     STATUS              RESTARTS   AGE
    hello-minikube   0/1       ContainerCreating   0          3s

If the output shows the STATUS as Running, it's now up and running. The product is identical to this:

    NAME             READY     STATUS    RESTARTS   AGE
    hello-minikube   1/1       Running   0          11m

### Get URL

To get the URL of the exposed Service to view its details, run the following command to

    minikube service hello-minikube --url

The console output is similar to this:

    [http://172.24.160.91:30599](http://172.24.160.91:30599)

### Browse the URL

To view the details, copy and paste the URL into your browser.

The output in the browser is similar to this:

    Hostname: hello-minikube

    Pod Information:
    	-no pod information available-

    Server values:
    	server_version=nginx: 1.13.3 - lua: 10008

    Request Information:
    	client_address=172.17.0.1
    	method=GET
    	real path=/
    	query=
    	request_version=1.1
    	request_scheme=http
    	request_uri=http://172.24.160.91:8080/

    Request Headers:
    	accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    	accept-encoding=gzip, deflate
    	accept-language=en-US,en;q=0.9
    	cache-control=max-age=0
    	connection=keep-alive
    	host=172.24.160.91:30599
    	upgrade-insecure-requests=1
    	user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36

    Request Body:
    	-no body in request-

Congratulations..!! You have successfully deployed a basic application on Local Kubernetes Cluster.

Thank you for reading. Keep visiting and share this in your network. Please put your thoughts and feedback in the comments section.

Follow on following channels to stay tuned on upcoming stories on C#

[C# Publication](https://medium.com/c-sharp-progarmming), [LinkedIn](https://www.linkedin.com/in/sukhpinder-singh-532284a2/), [Instagram](https://www.instagram.com/sukhpindersukh/), [Twitter](https://twitter.com/sukhsukhpinder), [Dev.to](https://dev.to/ssukhpinder), [Pinterest](https://in.pinterest.com/ssukhpinder/_created/), [Substack](https://sukhpinder.substack.com/), [Wix](https://www.csharp-dotnet.com/)

<a href="https://www.buymeacoffee.com/sukhpindersingh" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>