Redirect "Learning environment" to Install Tools task

pull/24533/head
Tim Bannister 2020-10-12 22:28:29 +01:00
parent 2ebd8a79f1
commit a6b52520cd
7 changed files with 54 additions and 563 deletions

View File

@ -2,3 +2,32 @@
title: Learning environment
weight: 20
---
<!--
{{/* There is a Netlify redirect from this page to /docs/tasks/tools/ */}}
{{/* This page content only exists to provide a navigation stub */}}
{{/* and to protect in case that redirect is one day removed. */}}
{{/* If you're localizing this page, you only need to copy the front matter */}}
{{/* and add a redirect into "/static/_redirects", for YOUR localization. */}}
-->
## kind
[`kind`](https://kind.sigs.k8s.io/docs/) lets you run Kubernetes on
your local computer. This tool requires that you have
[Docker](https://docs.docker.com/get-docker/) installed and configured.
The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page
shows you what you need to do to get up and running with kind.
## minikube
Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes
locally. `minikube` runs a single-node Kubernetes cluster on your personal
computer (including Windows, macOS and Linux PCs) so that you can try out
Kubernetes, or for daily development work.
You can follow the official
[Get Started!](https://minikube.sigs.k8s.io/docs/start/) guide if your focus is
on getting the tool installed.

View File

@ -1,23 +0,0 @@
---
title: Installing Kubernetes with Kind
weight: 40
content_type: concept
---
<!-- overview -->
Kind is a tool for running local Kubernetes clusters using Docker container "nodes".
<!-- body -->
## Installation
See [Installing Kind](https://kind.sigs.k8s.io/docs/user/quick-start/).

View File

@ -1,519 +0,0 @@
---
reviewers:
- dlorenc
- balopat
- aaron-prindle
title: Installing Kubernetes with Minikube
weight: 30
content_type: concept
---
<!-- overview -->
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.
<!-- body -->
## Minikube Features
Minikube supports the following Kubernetes features:
* DNS
* NodePorts
* ConfigMaps and Secrets
* Dashboards
* Container Runtime: [Docker](https://www.docker.com/), [CRI-O](https://cri-o.io/), and [containerd](https://github.com/containerd/containerd)
* Enabling CNI (Container Network Interface)
* Ingress
## Installation
See [Installing Minikube](/docs/tasks/tools/install-minikube/).
## Quickstart
This brief demo guides you on how to start, use, and delete Minikube locally. Follow the steps given below to start and explore Minikube.
1. Start Minikube and create a cluster:
```shell
minikube start
```
The output is similar to this:
```
Starting local Kubernetes cluster...
Running pre-create checks...
Creating machine...
Starting local Kubernetes cluster...
```
For more information on starting your cluster on a specific Kubernetes version, VM, or container runtime, see [Starting a Cluster](#starting-a-cluster).
2. Now, you can interact with your cluster using kubectl. For more information, see [Interacting with Your Cluster](#interacting-with-your-cluster).
Let's 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 create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
```
The output is similar to this:
```
deployment.apps/hello-minikube created
```
3. To access the `hello-minikube` Deployment, expose it as a Service:
```shell
kubectl expose deployment hello-minikube --type=NodePort --port=8080
```
The option `--type=NodePort` specifies the type of the Service.
The output is similar to this:
```
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.
Check if the Pod is up and running:
```shell
kubectl get pod
```
If the output shows the `STATUS` as `ContainerCreating`, the Pod is still being created:
```
NAME READY STATUS RESTARTS AGE
hello-minikube-3383150820-vctvh 0/1 ContainerCreating 0 3s
```
If the output shows the `STATUS` as `Running`, the Pod is now up and running:
```
NAME READY STATUS RESTARTS AGE
hello-minikube-3383150820-vctvh 1/1 Running 0 13s
```
5. Get the URL of the exposed Service to view the Service details:
```shell
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.
The output is similar to this:
```
Hostname: hello-minikube-7c77b68cff-8wdzq
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://192.168.99.100:8080/
Request Headers:
accept=*/*
host=192.168.99.100:30674
user-agent=curl/7.47.0
Request Body:
-no body in request-
```
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
```
The output is similar to this:
```
service "hello-minikube" deleted
```
8. Delete the `hello-minikube` Deployment:
```shell
kubectl delete deployment hello-minikube
```
The output is similar to this:
```
deployment.extensions "hello-minikube" deleted
```
9. Stop the local Minikube cluster:
```shell
minikube stop
```
The output is similar to this:
```
Stopping "minikube"...
"minikube" stopped.
```
For more information, see [Stopping a Cluster](#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](#deleting-a-cluster).
## 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/reference/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 `--driver=<enter_driver_name>` flag to `minikube start`.
For example the command would be.
```shell
minikube start --driver=<driver_name>
```
Minikube supports the following drivers:
{{< note >}}
See [DRIVERS](https://minikube.sigs.k8s.io/docs/reference/drivers/) for details on supported drivers and how to install
plugins.
{{< /note >}}
* docker ([driver installation](https://minikube.sigs.k8s.io/docs/drivers/docker/))
* virtualbox ([driver installation](https://minikube.sigs.k8s.io/docs/drivers/virtualbox/))
* podman ([driver installation](https://minikube.sigs.k8s.io/docs/drivers/podman/)) (EXPERIMENTAL)
* vmwarefusion
* kvm2 ([driver installation](https://minikube.sigs.k8s.io/docs/reference/drivers/kvm2/))
* hyperkit ([driver installation](https://minikube.sigs.k8s.io/docs/reference/drivers/hyperkit/))
* hyperv ([driver installation](https://minikube.sigs.k8s.io/docs/reference/drivers/hyperv/))
Note that the IP below is dynamic and can change. It can be retrieved with `minikube ip`.
* vmware ([driver installation](https://minikube.sigs.k8s.io/docs/reference/drivers/vmware/)) (VMware unified driver)
* parallels ([driver installation](https://minikube.sigs.k8s.io/docs/reference/drivers/parallels/))
* none (Runs the Kubernetes components on the host and not in a virtual machine. You need to be running Linux and to have {{< glossary_tooltip term_id="docker" >}} installed.)
{{< caution >}}
If you use the `none` driver, some Kubernetes components run as privileged containers that have side effects outside of the Minikube environment. Those side effects mean that the `none` driver is not recommended for personal workstations.
{{< /caution >}}
#### 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:
```bash
minikube start \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=containerd \
--bootstrapper=kubeadm
```
Or you can use the extended version:
```bash
minikube start \
--network-plugin=cni \
--enable-default-cni \
--extra-config=kubelet.container-runtime=remote \
--extra-config=kubelet.container-runtime-endpoint=unix:///run/containerd/containerd.sock \
--extra-config=kubelet.image-service-endpoint=unix:///run/containerd/containerd.sock \
--bootstrapper=kubeadm
```
{{% /tab %}}
{{% tab name="CRI-O" %}}
To use [CRI-O](https://cri-o.io/) as the container runtime, run:
```bash
minikube start \
--network-plugin=cni \
--enable-default-cni \
--container-runtime=cri-o \
--bootstrapper=kubeadm
```
Or you can use the extended version:
```bash
minikube start \
--network-plugin=cni \
--enable-default-cni \
--extra-config=kubelet.container-runtime=remote \
--extra-config=kubelet.container-runtime-endpoint=/var/run/crio.sock \
--extra-config=kubelet.image-service-endpoint=/var/run/crio.sock \
--bootstrapper=kubeadm
```
{{% /tab %}}
{{< /tabs >}}
#### Use local images by re-using the Docker daemon
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.
{{< 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 >}}
To work with the Docker daemon on your Mac/Linux host, run the last line from `minikube docker-env`.
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
docker ps
```
{{< note >}}
On Centos 7, Docker may report the following error:
```
Could not read CA certificate "/etc/docker/ca.pem": open /etc/docker/ca.pem: no such file or directory
```
You can fix this by updating /etc/sysconfig/docker to ensure that Minikube's environment changes are respected:
```shell
< DOCKER_CERT_PATH=/etc/docker
---
> if [ -z "${DOCKER_CERT_PATH}" ]; then
> DOCKER_CERT_PATH=/etc/docker
> fi
```
{{< /note >}}
### Configuring Kubernetes
Minikube has a "configurator" feature that allows users to configure the Kubernetes components with arbitrary values.
To use this feature, you can use the `--extra-config` flag on the `minikube start` command.
This flag is repeated, so you can pass it several times with several different values to set multiple options.
This flag takes a string of the form `component.key=value`, where `component` is one of the strings from the below list, `key` is a value on the
configuration struct and `value` is the value to set.
Valid keys can be found by examining the documentation for the Kubernetes `componentconfigs` for each component.
Here is the documentation for each supported configuration:
* [kubelet](https://godoc.org/k8s.io/kubernetes/pkg/kubelet/apis/config#KubeletConfiguration)
* [apiserver](https://godoc.org/k8s.io/kubernetes/cmd/kube-apiserver/app/options#ServerRunOptions)
* [proxy](https://godoc.org/k8s.io/kubernetes/pkg/proxy/apis/config#KubeProxyConfiguration)
* [controller-manager](https://godoc.org/k8s.io/kubernetes/pkg/controller/apis/config#KubeControllerManagerConfiguration)
* [etcd](https://godoc.org/github.com/coreos/etcd/etcdserver#ServerConfig)
* [scheduler](https://godoc.org/k8s.io/kubernetes/pkg/scheduler/apis/config#KubeSchedulerConfiguration)
#### Examples
To change the `MaxPods` setting to 5 on the Kubelet, pass this flag: `--extra-config=kubelet.MaxPods=5`.
This feature also supports nested structs. To change the `LeaderElection.LeaderElect` setting to `true` on the scheduler, pass this flag: `--extra-config=scheduler.LeaderElection.LeaderElect=true`.
To set the `AuthorizationMode` on the `apiserver` to `RBAC`, you can use: `--extra-config=apiserver.authorization-mode=RBAC`.
### Stopping a Cluster
The `minikube stop` command can be used to stop your cluster.
This command shuts down the Minikube Virtual Machine, but preserves all cluster state and data.
Starting the cluster again will restore it to its previous state.
### Deleting a Cluster
The `minikube delete` command can be used to delete your cluster.
This command shuts down and deletes the Minikube Virtual Machine. No data or state is preserved.
### Upgrading Minikube
If you are using macOS and [Brew Package Manager](https://brew.sh/) is installed run:
```shell
brew update
brew upgrade minikube
```
## Interacting with Your Cluster
### Kubectl
The `minikube start` command creates a [kubectl context](/docs/reference/generated/kubectl/kubectl-commands#-em-set-context-em-) called "minikube".
This context contains the configuration to communicate with your Minikube cluster.
Minikube sets this context to default automatically, but if you need to switch back to it in the future, run:
`kubectl config use-context minikube`
Or pass the context on each command like this:
`kubectl get pods --context=minikube`
### Dashboard
To access the [Kubernetes Dashboard](/docs/tasks/access-application-cluster/web-ui-dashboard/), run this command in a shell after starting Minikube to get the address:
```shell
minikube dashboard
```
### Services
To access a Service exposed via a node port, run this command in a shell after starting Minikube to get the address:
```shell
minikube service [-n NAMESPACE] [--url] NAME
```
## Networking
The Minikube VM is exposed to the host system via a host-only IP address, that can be obtained with the `minikube ip` command.
Any services of type `NodePort` can be accessed over that IP address, on the NodePort.
To determine the NodePort for your service, you can use a `kubectl` command like this:
`kubectl get service $SERVICE --output='jsonpath="{.spec.ports[0].nodePort}"'`
## Persistent Volumes
Minikube supports [PersistentVolumes](/docs/concepts/storage/persistent-volumes/) of type `hostPath`.
These PersistentVolumes are mapped to a directory inside the Minikube VM.
The Minikube VM boots into a tmpfs, so most directories will not be persisted across reboots (`minikube stop`).
However, Minikube is configured to persist files stored under the following host directories:
* `/data`
* `/var/lib/minikube`
* `/var/lib/docker`
Here is an example PersistentVolume config to persist data in the `/data` directory:
```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /data/pv0001/
```
## Mounted Host Folders
Some drivers will mount a host folder within the VM so that you can easily share files between the VM and host. These are not configurable at the moment and different for the driver and OS you are using.
{{< note >}}
Host folder sharing is not implemented in the KVM driver yet.
{{< /note >}}
| Driver | OS | HostFolder | VM |
| --- | --- | --- | --- |
| VirtualBox | Linux | `/home` | `/hosthome` |
| VirtualBox | macOS | `/Users` | `/Users` |
| VirtualBox | Windows | `C://Users` | `/c/Users` |
| VMware Fusion | macOS | `/Users` | `/mnt/hgfs/Users` |
| Xhyve | macOS | `/Users` | `/Users` |
## Private Container Registries
To access a private container registry, follow the steps on [this page](/docs/concepts/containers/images/).
We recommend you use `ImagePullSecrets`, but if you would like to configure access on the Minikube VM you can place the `.dockercfg` in the `/home/docker` directory or the `config.json` in the `/home/docker/.docker` directory.
## Add-ons
In order to have Minikube properly start or restart custom addons,
place the addons you wish to be launched with Minikube in the `~/.minikube/addons`
directory. Addons in this folder will be moved to the Minikube VM and
launched each time Minikube is started or restarted.
## Using Minikube with an HTTP Proxy
Minikube creates a Virtual Machine that includes Kubernetes and a Docker daemon.
When Kubernetes attempts to schedule containers using Docker, the Docker daemon may require external network access to pull containers.
If you are behind an HTTP proxy, you may need to supply Docker with the proxy settings.
To do this, pass the required environment variables as flags during `minikube start`.
For example:
```shell
minikube start --docker-env http_proxy=http://$YOURPROXY:PORT \
--docker-env https_proxy=https://$YOURPROXY:PORT
```
If your Virtual Machine address is 192.168.99.100, then chances are your proxy settings will prevent `kubectl` from directly reaching it.
To by-pass proxy configuration for this IP address, you should modify your no_proxy settings. You can do so with:
```shell
export no_proxy=$no_proxy,$(minikube ip)
```
## Known Issues
Features that require multiple nodes will not work in Minikube.
## Design
Minikube uses [libmachine](https://github.com/docker/machine/tree/master/libmachine) for provisioning VMs, and [kubeadm](https://github.com/kubernetes/kubeadm) to provision a Kubernetes cluster.
For more information about Minikube, see the [proposal](https://git.k8s.io/community/contributors/design-proposals/cluster-lifecycle/local-cluster-ux.md).
## Additional Links
* **Goals and Non-Goals**: For the goals and non-goals of the Minikube project, please see our [roadmap](https://minikube.sigs.k8s.io/docs/contrib/roadmap/).
* **Development Guide**: See [Contributing](https://minikube.sigs.k8s.io/docs/contrib/) for an overview of how to send pull requests.
* **Building Minikube**: For instructions on how to build/test Minikube from source, see the [build guide](https://minikube.sigs.k8s.io/docs/contrib/building/).
* **Adding a New Dependency**: For instructions on how to add a new dependency to Minikube, see the [adding dependencies guide](https://minikube.sigs.k8s.io/docs/contrib/drivers/).
* **Adding a New Addon**: For instructions on how to add a new addon for Minikube, see the [adding an addon guide](https://minikube.sigs.k8s.io/docs/contrib/addons/).
* **MicroK8s**: Linux users wishing to avoid running a virtual machine may consider [MicroK8s](https://microk8s.io/) as an alternative.
## Community
Contributions, questions, and comments are all welcomed and encouraged! Minikube developers hang out on [Slack](https://kubernetes.slack.com) in the `#minikube` channel (get an invitation [here](https://slack.kubernetes.io/)). We also have the [kubernetes-dev Google Groups mailing list](https://groups.google.com/forum/#!forum/kubernetes-dev). If you are posting to the list please prefix your subject with "minikube: ".

View File

@ -20,9 +20,20 @@ accessing your cluster.
You can also read the
[`kubectl` reference documentation](/docs/reference/kubectl/).
## kind
[`kind`](https://kind.sigs.k8s.io/docs/) lets you run Kubernetes on
your local computer. This tool it requires that you have
[Docker](https://docs.docker.com/get-docker/) installed and configured.
The kind [Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) page
shows you what you need to do to get up and running with kind.
<a class="btn btn-primary" href="https://kind.sigs.k8s.io/docs/user/quick-start/" role="button" aria-label="View kind Quick Start Guide">View kind Quick Start Guide</a>
## minikube
[`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes
Like `kind`, [`minikube`](https://minikube.sigs.k8s.io/) is a tool that lets you run Kubernetes
locally. `minikube` runs a single-node Kubernetes cluster on your personal
computer (including Windows, macOS and Linux PCs) so that you can try out
Kubernetes, or for daily development work.
@ -36,14 +47,3 @@ on getting the tool installed.
Once you have `minikube` working, you can use it to
[run a sample application](/docs/tutorials/hello-minikube/).
## kind
Like `minikube`, [`kind`](https://kind.sigs.k8s.io/docs/) lets you run Kubernetes on
your local computer. Unlike `minikube`, `kind` only works with a single container
runtime: it requires that you have [Docker](https://docs.docker.com/get-docker/)
installed and configured.
[Quick Start](https://kind.sigs.k8s.io/docs/user/quick-start/) shows you what
you need to do to get up and running with `kind`.
<a class="btn btn-primary" href="https://kind.sigs.k8s.io/docs/user/quick-start/" role="button" aria-label="View kind Quick Start Guide">View kind Quick Start Guide</a>

View File

@ -16,11 +16,12 @@ card:
<!-- overview -->
This tutorial shows you how to run a sample app
on Kubernetes using [Minikube](/docs/setup/learning-environment/minikube) and Katacoda.
on Kubernetes using [minikube](/docs/setup/learning-environment/minikube) and Katacoda.
Katacoda provides a free, in-browser Kubernetes environment.
{{< note >}}
You can also follow this tutorial if you've installed [Minikube locally](/docs/tasks/tools/install-minikube/).
You can also follow this tutorial if you've installed minikube locally.
See [minikube start](https://minikube.sigs.k8s.io/docs/start/) for installation instructions.
{{< /note >}}
@ -28,7 +29,7 @@ You can also follow this tutorial if you've installed [Minikube locally](/docs/t
## {{% heading "objectives" %}}
* Deploy a sample application to Minikube.
* Deploy a sample application to minikube.
* Run the app.
* View application logs.
@ -43,14 +44,14 @@ This tutorial provides a container image that uses NGINX to echo back all the re
<!-- lessoncontent -->
## Create a Minikube cluster
## Create a minikube cluster
1. Click **Launch Terminal**
{{< kat-button >}}
{{< note >}}
If you installed Minikube locally, run `minikube start`.
If you installed minikube locally, run `minikube start`.
{{< /note >}}
2. Open the Kubernetes dashboard in a browser:
@ -152,7 +153,7 @@ Kubernetes [*Service*](/docs/concepts/services-networking/service/).
```
On cloud providers that support load balancers,
an external IP address would be provisioned to access the Service. On Minikube,
an external IP address would be provisioned to access the Service. On minikube,
the `LoadBalancer` type makes the Service accessible through the `minikube service`
command.
@ -170,7 +171,7 @@ Kubernetes [*Service*](/docs/concepts/services-networking/service/).
## Enable addons
Minikube has a set of built-in {{< glossary_tooltip text="addons" term_id="addons" >}} that can be enabled, disabled and opened in the local Kubernetes environment.
The minikube tool includes a set of built-in {{< glossary_tooltip text="addons" term_id="addons" >}} that can be enabled, disabled and opened in the local Kubernetes environment.
1. List the currently supported addons:

View File

@ -1,7 +1,7 @@
You need to have a Kubernetes cluster, and the kubectl command-line tool must
be configured to communicate with your cluster. If you do not already have a
cluster, you can create one by using
[Minikube](/docs/setup/learning-environment/minikube/),
[minikube](/docs/tasks/tools/#minikube)
or you can use one of these Kubernetes playgrounds:
* [Katacoda](https://www.katacoda.com/courses/kubernetes/playground)

View File

@ -470,7 +470,10 @@
/docs/setup/version-skew-policy/ /docs/setup/release/version-skew-policy/ 301
/docs/setup/minikube/ /docs/setup/learning-environment/minikube/ 301
/docs/setup/minikube/ /docs/tasks/tools/ 302
/docs/setup/learning-environment/ /docs/tasks/tools/ 302!
/docs/setup/learning-environment/kind/ /docs/tasks/tools/ 302
/docs/setup/learning-environment/minikube/ /docs/tasks/tools/ 302
/docs/setup/cri/ /docs/setup/production-environment/container-runtimes/ 301
/docs/setup/independent/install-kubeadm/ /docs/setup/production-environment/tools/kubeadm/install-kubeadm/ 301
/ja/docs/setup/independent/install-kubeadm/ /ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ 301