Document Kubernetes support for Win (#5819)

* Document Kubernetes support for Win

* Address feedback
This commit is contained in:
Misty Stanley-Jones 2018-01-26 09:04:26 -08:00 committed by GitHub
parent d506e2f770
commit 0309ec51a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 243 additions and 124 deletions

View File

@ -2905,6 +2905,8 @@ manuals:
title: Getting started
- path: /docker-for-windows/install/
title: Install Docker for Windows
- path: /docker-for-windows/kubernetes/
title: Deploy on Kubernetes
- path: /docker-for-windows/troubleshoot/
title: Logs and troubleshooting
- path: /docker-for-windows/faqs/

View File

@ -0,0 +1,173 @@
{% assign platform = include.platform %}
{% comment %}
Include a chunk of this file, using variables already set in the file
where you want to reuse the chunk.
Usage: {% include kubernetes-mac-win.md platform="mac" %}
{% endcomment %}
{% if platform == "mac" %}
{% assign product = "Docker for Mac" %}
{% capture min-version %}{{ product }} 17.12 CE Edge{% endcapture %}
{% capture version-caveat %}
**Kubernetes is only available in {{ min-version }} and higher, on the Edge
channel.** Kubernetes support is not included in Docker for Mac Stable releases.
{% endcapture %}
{% capture local-kubectl-warning %}
> If you independently installed the Kubernetes CLI, `kubectl`, make sure that
> it is pointing to `docker-for-desktop` and not some other context such as
> `minikube` or a GKE cluster. Run: `kubectl config use-context docker-for-desktop`.
> If you experience conflicts with an existing `kubectl` installation, remove `/usr/local/bin/kubectl`.
{% endcapture %}
{% assign kubectl-path = "/usr/local/bin/kubectl" %}
{% elsif platform == "windows" %}
{% assign product = "Docker for Windows" %}
{% capture min-version %}{{ product }} 18.02 CE Edge{% endcapture %}
{% capture version-caveat %}
**Kubernetes is only available in {{ min-version }}.** Kubernetes
support is not included in {{ product }} 18.02 CE Stable.
{% endcapture %}
{% capture local-kubectl-warning %}
If you installed `kubectl` by another method, and experience conflicts, remove it.
{% endcapture %}
{% assign kubectl-path = "C:\>Program Files\Docker\Docker\Resources\bin\kubectl.exe" %}
{% endif %}
{{ version-caveat }} To find out more about Stable and Edge channels and how to
switch between them, see
[General configuration](/docker-for-{{ platform }}/#general).
{{ min-version }} includes a standalone Kubernetes server and client,
as well as Docker CLI integration. The Kubernetes server runs locally within
your Docker instance, is not configurable, and is a single-node cluster.
The Kubernetes server runs within a Docker container on your local system, and
is only for local testing. When Kubernetes support is enabled, you can deploy
your workloads, in parallel, on Kubernetes, Swarm, and as standalone containers.
Enabling or disabling the Kubernetes server does not affect your other
workloads.
See [{{ product }} > Getting started](/docker-for-{{ platform }}/index.md#kubernetes) to
enable Kubernetes and begin testing the deployment of your workloads on
Kubernetes.
{{ kubectl-warning }}
## Use Docker commands
You can deploy a stack on Kubernetes with `docker stack deploy`, the
`docker-compose.yml` file, and the name of the stack.
```bash
docker stack deploy --compose-file /path/to/docker-compose.yml mystack
docker stack services mystack
```
You can see the service deployed with the `kubectl get services` command.
### Specify a namespace
By default, the `default` namespace is used. You can specify a namespace with
the `--namespace` flag.
```bash
docker stack deploy --namespace my-app --compose-file /path/to/docker-compose.yml mystack
```
Run `kubectl get services -n my-app` to see only the services deployed in the
`my-app` namespace.
### Override the default orchestrator
While testing Kubernetes, you may want to deploy some workloads in swarm mode.
Use the `DOCKER_ORCHESTRATOR` variable to override the default orchestrator for
a given terminal session or a single Docker command. This variable can be unset
(the default, in which case Kubernetes is the orchestrator) or set to `swarm` or
`kubernetes`. The following command overrides the orchestrator for a single
deployment, by setting the variable{% if platform == "mac"" %}
at the start of the command itself.
```bash
DOCKER_ORCHESTRATOR=swarm docker stack deploy --compose-file /path/to/docker-compose.yml mystack
```{% elsif platform == "windows" %}
before running the command.
```shell
set DOCKER_ORCHESTRATOR=swarm
docker stack deploy --compose-file /path/to/docker-compose.yml mystack
```
{% endif %}
> **Note**: Deploying the same app in Kubernetes and swarm mode may lead to
> conflicts with ports and service names.
## Use the kubectl command
The {{ platform }} Kubernetes integration provides the Kubernetes CLI command
at `{{ kubernetes-path }}`. This location may not be in your shell's `PATH`
variable, so you may need to type the full path of the command or add it to
the `PATH`. For more information about `kubectl`, see the
[official `kubectl` documentation](https://kubernetes.io/docs/reference/kubectl/overview/).
You can test the command by listing the available nodes:
```bash
kubectl get nodes
NAME STATUS ROLES AGE VERSION
docker-for-desktop Ready master 3h v1.8.2
```
## Example app
Docker has created the following demo app that you can deploy to swarm mode or
to Kubernetes using the `docker stack deploy` command.
```yaml
version: '3.3'
services:
web:
build: web
image: dockerdemos/lab-web
volumes:
- "./web/static:/static"
ports:
- "80:80"
words:
build: words
image: dockerdemos/lab-words
deploy:
replicas: 5
endpoint_mode: dnsrr
resources:
limits:
memory: 16M
reservations:
memory: 16M
db:
build: db
image: dockerdemos/lab-db
```
If you already have a Kubernetes YAML file, you can deploy it using the
`kubectl` command.

View File

@ -1,6 +1,6 @@
---
description: Getting Started
keywords: mac, beta, edge, alpha, tutorial
keywords: mac, edge, tutorial
redirect_from:
- /mackit/
- /mackit/getting-started/
@ -297,13 +297,14 @@ choose to discard or not apply changes when asked.
### Kubernetes
**Kubernetes is only available in Docker for Mac 17.12 CE Edge.** Kubernetes
support is not included in Docker for Mac 17.12 CE Stable. To find out
more about Stable and Edge channels and how to switch between them, see
[General configuration](/docker-for-mac/#general).
**Kubernetes is only available in Docker for Mac 17.12 CE and higher, on the Edge
channel.** Kubernetes support is not included in Docker for Mac Stable releases.
To find out more about Stable and Edge channels and how to switch between them,
see [General configuration](/docker-for-mac/#general).
Docker for Mac 17.12 CE Edge includes a standalone Kubernetes server that runs
on your Mac, so that you can test deploying your Docker workloads on Kubernetes.
Docker for Mac 17.12 CE (and higher) Edge includes a standalone Kubernetes server
that runs on your Mac, so that you can test deploying your Docker workloads on
Kubernetes.
The Kubernetes client command, `kubectl`, is included and configured to connect
to the local Kubernetes server. If you have `kubectl` already installed and

View File

@ -4,119 +4,4 @@ keywords: mac, edge, kubernetes, kubectl, orchestration
title: Deploy to Kubernetes
---
**Kubernetes is only available in Docker for Mac 17.12 CE Edge.** Kubernetes
support is not included in Docker for Mac 17.12 CE Stable. To find out
more about Stable and Edge channels and how to switch between them, see
[General configuration](/docker-for-mac/#general).
Docker for Mac 17.12 CE Edge includes a standalone Kubernetes server and client,
as well as Docker CLI integration. The Kubernetes server runs locally within
your Docker instance, is not configurable, and is a single-node cluster.
The Kubernetes server runs within a Docker container on your Mac, and is only
for local testing. When Kubernetes support is enabled, you can deploy your
workloads, in parallel, on Kubernetes, Swarm, and as standalone containers.
Enabling or disabling the Kubernetes server does not affect your other
workloads.
See [Docker for Mac > Getting started](/docker-for-mac/index.md#kubernetes) to
enable Kubernetes and begin testing the deployment of your workloads on
Kubernetes.
> If you independently installed the Kubernetes CLI, `kubectl`, make sure that
> it is pointing to `docker-for-desktop` and not some other context such as
> `minikube` or a GKE cluster. Run: `kubectl config use-context docker-for-desktop`.
> If you experience conflicts with an existing `kubectl` installation, remove `/usr/local/bin/kubectl`.
## Use Docker commands
You can deploy a stack on Kubernetes with `docker stack deploy`, the
`docker-compose.yml` file, and the name of the stack.
```bash
$ docker stack deploy --compose-file /path/to/docker-compose.yml mystack
$ docker stack services mystack
```
You can see the service deployed with the `kubectl get services` command.
### Specify a namespace
By default, the `default` namespace is used. You can specify a namespace with
the `--namespace` flag.
```bash
$ docker stack deploy --namespace my-app --compose-file /path/to/docker-compose.yml mystack
```
Run `kubectl get services -n my-app` to see only the services deployed in the
`my-app` namespace.
### Override the default orchestrator
While testing Kubernetes, you may want to deploy some workloads in swarm mode.
Use the `DOCKER_ORCHESTRATOR` variable to override the default orchestrator for
a given terminal session or a single Docker command. This variable can be unset
(the default, in which case Kubernetes is the orchestrator) or set to `swarm` or
`kubernetes`. The following command overrides the orchestrator for a single
deployment, by setting the variable at the start of the command itself.
```bash
DOCKER_ORCHESTRATOR=swarm docker stack deploy --compose-file /path/to/docker-compose.yml mystack
```
> **Note**: Deploying the same app in Kubernetes and swarm mode may lead to
> conflicts with ports and service names.
## Use the kubectl command
The Docker for Mac Kubernetes integration provides the Kubernetes CLI command
at `/usr/local/bin/kubectl`. This location may not be in your shell's `PATH`
variable, so you may need to type the full path of the command or add it to
the `PATH`. For more information about `kubectl`, see the
[official `kubectl` documentation](https://kubernetes.io/docs/reference/kubectl/overview/).
You can test the command by listing the available nodes:
```bash
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
docker-for-desktop Ready master 3h v1.8.2
```
## Example app
Docker has created the following demo app that you can deploy to swarm mode or
to Kubernetes using the `docker stack deploy` command.
```yaml
version: '3.3'
services:
web:
build: web
image: dockerdemos/lab-web
volumes:
- "./web/static:/static"
ports:
- "80:80"
words:
build: words
image: dockerdemos/lab-words
deploy:
replicas: 5
endpoint_mode: dnsrr
resources:
limits:
memory: 16M
reservations:
memory: 16M
db:
build: db
image: dockerdemos/lab-db
```
If you already have a Kubernetes YAML file, you can deploy it using the
`kubectl` command.
{% include kubernetes-mac-win.md platform="mac" %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -1,6 +1,6 @@
---
description: Getting Started
keywords: windows, beta, edge, alpha, tutorial
keywords: windows, edge, tutorial
redirect_from:
- /winkit/getting-started/
- /winkit/
@ -705,6 +705,57 @@ Check out these [Docker Cloud topics](/docker-cloud/index.md) to learn more:
Need a direct link to Cloud? [Take me to Docker
Cloud](https://cloud.docker.com/){: target="_blank" class="_" }.
### Kubernetes
**Kubernetes is only available in Docker for Windows 18.02 CE Edge.** Kubernetes
upport is not included in Docker for Windows 18.02 CE Stable.
To find out more about Stable and Edge channels and how to switch between them,
see [General configuration](/docker-for-windows/#general).
Docker for Windows 18.02 CE Edge includes a standalone Kubernetes server that runs
on your Windows host, so that you can test deploying your Docker workloads on Kubernetes.
The Kubernetes client command, `kubectl`, is included and configured to connect
to the local Kubernetes server. If you have `kubectl` already installed and
pointing to some other environment, such as `minikube` or a GKE cluster, be sure
to change context so that `kubectl` is pointing to `docker-for-desktop`:
```bash
kubectl config get-contexts
kubectl config use-context docker-for-desktop
```
If you installed `kubectl` by another method, and
experience conflicts, remove it.
- To enable Kubernetes support and install a standalone instance of Kubernetes
running as a Docker container, select **Enable Kubernetes** and click the
**Apply and restart** button.
![Enable Kubernetes](/docker-for-windows/images/kubernetes/kubernetes-enable.png)
An internet connection is required. Images required to run the Kubernetes
server are downloaded and instantiated as containers, and the
`C:\>Program Files\Docker\Docker\Resources\bin\kubectl.exe` command is installed.
When Kubernetes is enabled and running, an additional status bar item displays
at the bottom left of the Docker for Windows Preferences dialog.
![Kubernetes status](/docker-for-windows/images/kubernetes/kubernetes-status.png)
- By default, Kubernetes containers are hidden from commands like `docker
service ls`, because managing them manually is not supported. To make them
visible, select **Show system containers (advanced)** and click **Apply and restart**.
Most users do not need this option.
- To disable Kubernetes support at any time, deselect **Enable Kubernetes**.
The Kubernetes containers are stopped and removed, and the
`/usr/local/bin/kubectl` command is removed.
For more about using the Kubernetes integration with
Docker for Windows, see [Deploy to Kubernetes](/docker-for-windows/kubernetes.md).
### Giving feedback and getting help
To get help from the community, review current user topics, join or start a

View File

@ -0,0 +1,7 @@
---
description: Deploying to Kubernetes on Docker for Windows
keywords: windows, edge, kubernetes, kubectl, orchestration
title: Deploy to Kubernetes
---
{% include kubernetes-mac-win.md platform="windows" %}