⎈ k8s knowledge compiler

Hello Minikube [page]deterministic

tutorials

This tutorial shows you how to run a sample app on Kubernetes using minikube. The tutorial provides a container image that uses NGINX to echo back all the requests.

##

* Deploy a sample application to minikube. * Run the app. * View application logs.

##

This tutorial assumes that you have already set up `minikube`. See __Step 1__ in [minikube start](https://minikube.sigs.k8s.io/docs/start/) for installation instructions.

Only execute the instructions in __Step 1, Installation__. The rest is covered on this page.

You also need to install `kubectl`. See [Install tools](/docs/tasks/tools/#kubectl) for installation instructions.

## Create a minikube cluster

```shell minikube start ```

## Check the status of the minikube cluster

Verify the status of the minikube cluster to ensure all the components are in a running state.

```shell minikube status ``` The output from the above command should show all components Running or Configured, as shown in the example output below:

``` minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured ```

## Open the Dashboard

Open the Kubernetes dashboard. You can do this two different ways:

Open a new terminal, and run: ```shell # Start a new terminal, and leave this running. minikube dashboard ```

Now, switch back to the terminal where you ran `minikube start`.

The `dashboard` command enables the dashboard add-on and opens the proxy in the default web browser. You can create Kubernetes resources on the dashboard such as Deployment and Service.

To find out how to avoid directly invoking the browser from the terminal and get a URL for the web dashboard, see the "URL copy and paste" tab.

By default, the dashboard is only accessible from within the internal Kubernetes virtual network. The `dashboard` command creates a temporary proxy to make the dashboard accessible from outside the Kubernetes virtual network.

To stop the proxy, run `Ctrl+C` to exit the process. After the command exits, the dashboard remains running in the Kubernetes cluster. You can run the `dashboard` command again to create another proxy to access the dashboard.

If you don't want minikube to open a web browser for you, run the `dashboard` subcommand with the `--url` flag. `minikube` outputs a URL that you can open in the browser you prefer.

Open a new terminal, and run: ```shell # Start a new terminal, and leave this running. minikube dashboard --url ```

Now, you can use this URL and switch back to the terminal where you ran `minikube start`.

## Create a Deployment

A Kubernetes [*Pod*](/docs/concepts/workloads/pods/) is a group of one or more Containers, tied together for the purposes of administration and networking. The Pod in this tutorial has only one Container. A Kubernetes [*Deployment*](/docs/concepts/workloads/controllers/deployment/) checks on the health of your Pod and restarts the Pod's Container if it terminates. Deployments are the recommended way to manage the creation and scaling of Pods.

1. Use the `kubectl create` command to create a Deployment that manages a Pod. The Pod runs a Container based on the provided Docker image.

```shell # Run a test container image that includes a webserver kubectl create deployment hello-node --image=registry.k8s.io/e2e-test-images/agnhost:2.53 -- /agnhost netexec --http-port=8080 ```

1. View the Deployment:

```shell kubectl get deployments ```

The output is similar to:

``` NAME READY UP-TO-DATE AVAILABLE AGE hello-node 1/1 1 1 1m ```

(It may take some time for the pod to become available. If you see "0/1", try again in a few seconds.)

1. View the Pod:

```shell kubectl get pods ```

The output is similar to:

``` NAME READY STATUS RESTARTS AGE hello-node-5f76cf6ccf-br9b5 1/1 Running 0 1m ```

1. View clust …(trimmed)

Sources

tutorials/hello-minikube.md · docHello Minikube

Related (12)

references Add-onsaddons conf=1
part_of {{% heading "objectives" %}}describes conf=1
part_of {{% heading "prerequisites" %}}describes conf=1
part_of Create a minikube clusterdescribes conf=1
part_of Check the status of the minikube clusterdescribes conf=1
part_of Open the Dashboarddescribes conf=1
part_of Create a Deploymentdescribes conf=1
part_of Create a Servicedescribes conf=1
part_of Enable addonsdescribes conf=1
part_of Clean updescribes conf=1
part_of Conclusiondescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1

← all Docs