DEV Community

loading...
Cover image for Getting Started with Minikube Kubernetes

Getting Started with Minikube Kubernetes

Sukhpinder Singh
I'm Sukhpinder Singh, a passionate self-taught .Net developer from India. Skills C# | Microsoft Certified | Medium Blogger | .Net Core | Xamarin | ASP.Net | Angular
・4 min read

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

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

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

Prerequisites

  • Install kubectl if not installed already. Link

  • Install a hypervisor if not installed already. Hyper-V or VirtualBox

Minimum System specifications

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

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

Stop Minikube

To stop the local Minikube Kubernetes cluster, run:

minikube stop
Enter fullscreen mode Exit fullscreen mode

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

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

The console output is similar to this:

deployment.apps/hello-minikube created
Enter fullscreen mode Exit fullscreen mode

Access Minikube Deployment

Expose it as a Service:

kubectl expose deployment hello-minikube --type=NodePort --port=8080
Enter fullscreen mode Exit fullscreen mode

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

The console output is similar to this:

service/hello-minikube exposed
Enter fullscreen mode Exit fullscreen mode

Check container status

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

kubectl get pod
Enter fullscreen mode Exit fullscreen mode

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

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

Get URL

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

minikube service hello-minikube --url
Enter fullscreen mode Exit fullscreen mode

The console output is similar to this:

[http://172.24.160.91:30599](http://172.24.160.91:30599)
Enter fullscreen mode Exit fullscreen mode

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

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, LinkedIn, Instagram, Twitter, Dev.to, Pinterest, Substack, Wix

Buy Me A Coffee

Discussion (0)