[WIP] Clean up and reorganize minikube.md (#14255)

The current content was not following the style guide and lacked information on what the user was doing under the quick start section. Added more information and tested the section out. Further reorganized the content.

Correct typos

Updated the content.

Updated the content

Fixed syntax error.

Update the unordered list formatting

Fix formatting issues

Formatting update

Format the content

Format the content

Format content

Format ordered content

Format unordered list

Clean up and reorganize minikube.md

Updated the content

Updated the content as per the comments received.

Fixed an error

Fixes the note shortcode

Fixes error in shortcode

Clean up and reorganize minikube.md
This commit is contained in:
shavidissa
2019-05-29 00:00:21 -07:00
committed by Kubernetes Prow Robot
parent f38c90768d
commit 5c9a9b1fe2
+126 -125
View File
@@ -9,7 +9,7 @@ content_template: templates/concept
{{% capture overview %}} {{% capture overview %}}
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day. Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day.
{{% /capture %}} {{% /capture %}}
@@ -17,14 +17,15 @@ Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a
## Minikube Features ## Minikube Features
* Minikube supports Kubernetes features such as: Minikube supports the following Kubernetes features:
* DNS
* NodePorts * DNS
* ConfigMaps and Secrets * NodePorts
* Dashboards * ConfigMaps and Secrets
* Container Runtime: Docker, [rkt](https://github.com/rkt/rkt), [CRI-O](https://github.com/kubernetes-incubator/cri-o) and [containerd](https://github.com/containerd/containerd) * Dashboards
* Enabling CNI (Container Network Interface) * Container Runtime: Docker, [rkt](https://github.com/rkt/rkt), [CRI-O](https://github.com/kubernetes-incubator/cri-o), and [containerd](https://github.com/containerd/containerd)
* Ingress * Enabling CNI (Container Network Interface)
* Ingress
## Installation ## Installation
@@ -32,25 +33,13 @@ See [Installing Minikube](/docs/tasks/tools/install-minikube/).
## Quickstart ## Quickstart
Here's a brief demo of Minikube usage. This brief demo guides you on how to start, use, and delete Minikube locally. Follow the steps given below to start and explore Minikube.
If you want to change the VM driver add the appropriate `--vm-driver=xxx` flag to `minikube start`. Minikube supports
the following drivers:
* virtualbox 1. Start Minikube and create a cluster:
* vmwarefusion ```shell
* kvm2 ([driver installation](https://git.k8s.io/minikube/docs/drivers.md#kvm2-driver))
* hyperkit ([driver installation](https://git.k8s.io/minikube/docs/drivers.md#hyperkit-driver))
* hyperv ([driver installation](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#hyperv-driver))
Note that the IP below is dynamic and can change. It can be retrieved with `minikube ip`.
* vmware ([driver installation](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#vmware-unified-driver)) (VMware unified driver)
* none (Runs the Kubernetes components on the host and not in a VM. Using this driver requires Docker ([docker install](https://docs.docker.com/install/linux/docker-ce/ubuntu/)) and a Linux environment)
1. Start a minikube
```
minikube start minikube start
``` ```
The output shows that the kubernetes cluster is started: The output is similar to this:
``` ```
Starting local Kubernetes cluster... Starting local Kubernetes cluster...
@@ -58,60 +47,51 @@ Note that the IP below is dynamic and can change. It can be retrieved with `mini
Creating machine... Creating machine...
Starting local Kubernetes cluster... Starting local Kubernetes cluster...
``` ```
For more information on starting your cluster on a specific Kubernetes version, VM, or container runtime, see [Starting a Cluster](docs/setup/minikube/#starting-a-cluster).
2. Create an echo server deployment 2. Now, you can interact with your cluster using kubectl. For more information, see [Interacting with Your Cluster](docs/setup/minikube/#interacting-with-your-cluster).
``` Lets create a Kubernetes Deployment using an existing image named `echoserver`, which is a simple HTTP server and expose it on port 8080 using `--port`.
```shell
kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080 kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080
``` ```
The output of a successful command verifies that the deployment is created: The output is similar to this:
``` ```
deployment.apps/hello-minikube created deployment.apps/hello-minikube created
``` ```
3. To access the `hello-minikue` Deployment, expose it as a Service:
3. Expose an echo server deployment to create service ```shell
```
kubectl expose deployment hello-minikube --type=NodePort kubectl expose deployment hello-minikube --type=NodePort
``` ```
The output of a successful command verifies that the service is created: The option `--type=NodePort` specifies the type of the Service.
The output is similar to this:
``` ```
service/hello-minikube exposed service/hello-minikube exposed
``` ```
4. The `hello-minikube` Pod is now launched but you have to wait until the Pod is up before accessing it via the exposed Service.
4. Check whether the pod is up and running Check if the Pod is up and running:
```shell
```
kubectl get pod kubectl get pod
``` ```
The output displays the pod is still being created: If the output shows the `STATUS` as `ContainerCreating`, the Pod is still being created:
``` ```
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
hello-minikube-3383150820-vctvh 0/1 ContainerCreating 0 3s hello-minikube-3383150820-vctvh 0/1 ContainerCreating 0 3s
``` ```
If the output shows the `STATUS` as `Running`, the Pod is now up and running:
5. Wait for while and then check again, whether the pod is up and running using same command
```
kubectl get pod
```
Now the output displays the pod is created and it is running:
``` ```
NAME READY STATUS RESTARTS AGE NAME READY STATUS RESTARTS AGE
hello-minikube-3383150820-vctvh 1/1 Running 0 13s hello-minikube-3383150820-vctvh 1/1 Running 0 13s
``` ```
5. Get the URL of the exposed Service to view the Service details:
6. Curl service which we have created ```shell
minikube service hello-minikube --url
``` ```
curl $(minikube service hello-minikube --url) 6. To view the details of your local cluster, copy and paste the URL you got as the output, on your browser.
```
Output looks similer to this:
The output is similar to this:
``` ```
Hostname: hello-minikube-7c77b68cff-8wdzq Hostname: hello-minikube-7c77b68cff-8wdzq
@@ -138,44 +118,99 @@ Note that the IP below is dynamic and can change. It can be retrieved with `mini
Request Body: Request Body:
-no body in request- -no body in request-
``` ```
7. Delete the service which we have created If you no longer want the Service and cluster to run, you can delete them.
7. Delete the `hello-minikube` Service:
``` ```shell
kubectl delete services hello-minikube kubectl delete services hello-minikube
``` ```
The output of a successful command verifies that the service is deleted: The output is similar to this:
``` ```
service "hello-minikube" deleted service "hello-minikube" deleted
``` ```
8. Delete the deployment which we have created 8. Delete the `hello-minikube` Deployment:
```shell
```
kubectl delete deployment hello-minikube kubectl delete deployment hello-minikube
``` ```
The output of a successful command verifies that the deployment is deleted: The output is similar to this:
``` ```
deployment.extensions "hello-minikube" deleted deployment.extensions "hello-minikube" deleted
``` ```
9. Stop a minikube 9. Stop the local Minikube cluster:
```shell
```
minikube stop minikube stop
``` ```
The output displays the kubernetes cluster is stopping: The output is similar to this:
``` ```
Stopping local Kubernetes cluster...
Stopping "minikube"... Stopping "minikube"...
"minikube" stopped.
``` ```
For more information, see [Stopping a Cluster](docs/setup/minikube/#stopping-a-cluster).
10. Delete the local Minikube cluster:
```shell
minikube delete
```
The output is similar to this:
```
Deleting "minikube" ...
The "minikube" cluster has been deleted.
```
For more information, see [Deleting a cluster](/docs/setup/minikube/#deleting-a-cluster).
### Alternative Container Runtimes ## Managing your Cluster
#### containerd ### Starting a Cluster
The `minikube start` command can be used to start your cluster.
This command creates and configures a Virtual Machine that runs a single-node Kubernetes cluster.
This command also configures your [kubectl](/docs/user-guide/kubectl-overview/) installation to communicate with this cluster.
{{< note >}}
If you are behind a web proxy, you need to pass this information to the `minikube start` command:
```shell
https_proxy=<my proxy> minikube start --docker-env http_proxy=<my proxy> --docker-env https_proxy=<my proxy> --docker-env no_proxy=192.168.99.0/24
```
Unfortunately, setting the environment variables alone does not work.
Minikube also creates a "minikube" context, and sets it to default in kubectl.
To switch back to this context, run this command: `kubectl config use-context minikube`.
{{< /note >}}
#### Specifying the Kubernetes version
You can specify the version of Kubernetes for Minikube to use by
adding the `--kubernetes-version` string to the `minikube start` command. For
example, to run version {{< param "fullversion" >}}, you would run the following:
```
minikube start --kubernetes-version {{< param "fullversion" >}}
```
#### Specifying the VM driver
You can change the VM driver by adding the `--vm-driver=<enter_driver_name>` flag to `minikube start`.
For example the command would be.
```shell
minikube start --vm-driver=<driver_name>
```
Minikube supports the following drivers:
{{< note >}}
See [DRIVERS](https://git.k8s.io/minikube/docs/drivers.md) for details on supported drivers and how to install
plugins.
{{< /note >}}
* virtualbox
* vmwarefusion
* kvm2 ([driver installation](https://git.k8s.io/minikube/docs/drivers.md#kvm2-driver))
* hyperkit ([driver installation](https://git.k8s.io/minikube/docs/drivers.md#hyperkit-driver))
* hyperv ([driver installation](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#hyperv-driver))
Note that the IP below is dynamic and can change. It can be retrieved with `minikube ip`.
* vmware ([driver installation](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#vmware-unified-driver)) (VMware unified driver)
* none (Runs the Kubernetes components on the host and not in a VM. Using this driver requires Docker ([docker install](https://docs.docker.com/install/linux/docker-ce/ubuntu/)) and a Linux environment)
#### Starting a cluster on alternative container runtimes
You can start Minikube on the following container runtimes.
{{< tabs name="container_runtimes" >}}
{{% tab name="containerd" %}}
To use [containerd](https://github.com/containerd/containerd) as the container runtime, run: To use [containerd](https://github.com/containerd/containerd) as the container runtime, run:
```bash ```bash
minikube start \ minikube start \
--network-plugin=cni \ --network-plugin=cni \
@@ -195,11 +230,9 @@ minikube start \
--extra-config=kubelet.image-service-endpoint=unix:///run/containerd/containerd.sock \ --extra-config=kubelet.image-service-endpoint=unix:///run/containerd/containerd.sock \
--bootstrapper=kubeadm --bootstrapper=kubeadm
``` ```
{{% /tab %}}
#### CRI-O {{% tab name="CRI-O" %}}
To use [CRI-O](https://github.com/kubernetes-incubator/cri-o) as the container runtime, run: To use [CRI-O](https://github.com/kubernetes-incubator/cri-o) as the container runtime, run:
```bash ```bash
minikube start \ minikube start \
--network-plugin=cni \ --network-plugin=cni \
@@ -207,7 +240,6 @@ minikube start \
--container-runtime=cri-o \ --container-runtime=cri-o \
--bootstrapper=kubeadm --bootstrapper=kubeadm
``` ```
Or you can use the extended version: Or you can use the extended version:
```bash ```bash
@@ -219,48 +251,47 @@ minikube start \
--extra-config=kubelet.image-service-endpoint=/var/run/crio.sock \ --extra-config=kubelet.image-service-endpoint=/var/run/crio.sock \
--bootstrapper=kubeadm --bootstrapper=kubeadm
``` ```
{{% /tab %}}
#### rkt container engine {{% tab name="rkt container engine" %}}
To use [rkt](https://github.com/rkt/rkt) as the container runtime run: To use [rkt](https://github.com/rkt/rkt) as the container runtime run:
```shell ```shell
minikube start \ minikube start \
--network-plugin=cni \ --network-plugin=cni \
--enable-default-cni \ --enable-default-cni \
--container-runtime=rkt --container-runtime=rkt
``` ```
This will use an alternative minikube ISO image containing both rkt, and Docker, and enable CNI networking. This will use an alternative minikube ISO image containing both rkt, and Docker, and enable CNI networking.
{{% /tab %}}
{{< /tabs >}}
### Driver plugins #### Use local images by re-using the Docker daemon
See [DRIVERS](https://git.k8s.io/minikube/docs/drivers.md) for details on supported drivers and how to install When using a single VM for Kubernetes, it's useful to reuse Minikube's built-in Docker daemon. Reusing the built-in daemon means you don't have to build a Docker registry on your host machine and push the image into it. Instead, you can build inside the same Docker daemon as Minikube, which speeds up local experiments.
plugins, if required.
### Use local images by re-using the Docker daemon {{< note >}}
Be sure to tag your Docker image with something other than latest and use that tag to pull the image. Because `:latest` is the default value, with a corresponding default image pull policy of `Always`, an image pull error (`ErrImagePull`) eventually results if you do not have the Docker image in the default Docker registry (usually DockerHub).
{{< /note >}}
When using a single VM of Kubernetes, it's really handy to reuse the Minikube's built-in Docker daemon; as this means you don't have to build a docker registry on your host machine and push the image into it - you can just build inside the same docker daemon as minikube which speeds up local experiments. Just make sure you tag your Docker image with something other than 'latest' and use that tag while you pull the image. Otherwise, if you do not specify version of your image, it will be assumed as `:latest`, with pull image policy of `Always` correspondingly, which may eventually result in `ErrImagePull` as you may not have any versions of your Docker image out there in the default docker registry (usually DockerHub) yet. To work with the Docker daemon on your Mac/Linux host, use the `docker-env command` in your shell:
To be able to work with the docker daemon on your mac/linux host use the `docker-env command` in your shell:
```shell ```shell
eval $(minikube docker-env) eval $(minikube docker-env)
``` ```
You should now be able to use docker on the command line on your host mac/linux machine talking to the docker daemon inside the minikube VM: You can now use Docker at the command line of your host Mac/Linux machine to communicate with the Docker daemon inside the Minikube VM:
```shell ```shell
docker ps docker ps
``` ```
On Centos 7, docker may report the following error: {{< note >}}
On Centos 7, Docker may report the following error:
```shell ```
Could not read CA certificate "/etc/docker/ca.pem": open /etc/docker/ca.pem: no such file or directory Could not read CA certificate "/etc/docker/ca.pem": open /etc/docker/ca.pem: no such file or directory
``` ```
The fix is to update /etc/sysconfig/docker to ensure that Minikube's environment changes are respected: You can fix this by updating /etc/sysconfig/docker to ensure that Minikube's environment changes are respected:
```shell ```shell
< DOCKER_CERT_PATH=/etc/docker < DOCKER_CERT_PATH=/etc/docker
@@ -269,37 +300,7 @@ The fix is to update /etc/sysconfig/docker to ensure that Minikube's environment
> DOCKER_CERT_PATH=/etc/docker > DOCKER_CERT_PATH=/etc/docker
> fi > fi
``` ```
{{< /note >}}
Remember to turn off the imagePullPolicy:Always, otherwise Kubernetes won't use images you built locally.
## Managing your Cluster
### Starting a Cluster
The `minikube start` command can be used to start your cluster.
This command creates and configures a Virtual Machine that runs a single-node Kubernetes cluster.
This command also configures your [kubectl](/docs/user-guide/kubectl-overview/) installation to communicate with this cluster.
If you are behind a web proxy, you will need to pass this information to the `minikube start` command:
```shell
https_proxy=<my proxy> minikube start --docker-env http_proxy=<my proxy> --docker-env https_proxy=<my proxy> --docker-env no_proxy=192.168.99.0/24
```
Unfortunately just setting the environment variables will not work.
Minikube will also create a "minikube" context, and set it to default in kubectl.
To switch back to this context later, run this command: `kubectl config use-context minikube`.
#### Specifying the Kubernetes version
You can specify the specific version of Kubernetes for Minikube to use by
adding the `--kubernetes-version` string to the `minikube start` command. For
example, to run version `v1.7.3`, you would run the following:
```
minikube start --kubernetes-version v1.7.3
```
### Configuring Kubernetes ### Configuring Kubernetes
@@ -361,7 +362,7 @@ minikube dashboard
### Services ### Services
To access a service exposed via a node port, run this command in a shell after starting Minikube to get the address: To access a Service exposed via a node port, run this command in a shell after starting Minikube to get the address:
```shell ```shell
minikube service [-n NAMESPACE] [--url] NAME minikube service [-n NAMESPACE] [--url] NAME