k3s/docs/getting-started-guides/docker-multinode.md

132 lines
4.6 KiB
Markdown
Raw Normal View History

2015-07-12 04:04:52 +00:00
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
2015-07-16 17:02:26 +00:00
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
width="25" height="25">
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
2015-12-14 18:37:38 +00:00
<!-- TAG RELEASE_LINK, added by the munger automatically -->
2015-07-16 17:02:26 +00:00
<strong>
2015-11-03 18:17:57 +00:00
The latest release of this document can be found
[here](http://releases.k8s.io/release-1.1/docs/getting-started-guides/docker-multinode.md).
2015-07-16 17:02:26 +00:00
Documentation for other releases can be found at
[releases.k8s.io](http://releases.k8s.io).
</strong>
--
2015-07-13 22:15:35 +00:00
2015-07-12 04:04:52 +00:00
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
Running Multi-Node Kubernetes Using Docker
------------------------------------------
2015-04-06 23:29:46 +00:00
2015-04-07 04:47:04 +00:00
_Note_:
These instructions are somewhat significantly more advanced than the [single node](docker.md) instructions. If you are
2015-04-06 23:29:46 +00:00
interested in just starting to explore Kubernetes, we recommend that you start there.
**Table of Contents**
- [Prerequisites](#prerequisites)
- [Overview](#overview)
- [Bootstrap Docker](#bootstrap-docker)
- [Master Node](#master-node)
- [Adding a worker node](#adding-a-worker-node)
- [Deploy a DNS](#deploy-a-dns)
- [Testing your cluster](#testing-your-cluster)
2015-04-06 23:29:46 +00:00
## Prerequisites
2015-07-17 22:35:41 +00:00
The only thing you need is a machine with **Docker 1.7.1 or higher**
2015-07-23 03:09:05 +00:00
2015-04-07 04:47:04 +00:00
## Overview
2015-07-17 22:35:41 +00:00
This guide will set up a 2-node Kubernetes cluster, consisting of a _master_ node which hosts the API server and orchestrates work
2015-04-07 04:47:04 +00:00
and a _worker_ node which receives work from the master. You can repeat the process of adding worker nodes an arbitrary number of
times to create larger clusters.
2015-04-06 23:29:46 +00:00
2015-04-07 04:47:04 +00:00
Here's a diagram of what the final result will look like:
![Kubernetes Single Node on Docker](k8s-docker.png)
2015-04-06 23:29:46 +00:00
2015-04-07 04:47:04 +00:00
### Bootstrap Docker
2015-07-17 22:35:41 +00:00
2015-04-07 04:47:04 +00:00
This guide also uses a pattern of running two instances of the Docker daemon
1) A _bootstrap_ Docker instance which is used to start system daemons like `flanneld` and `etcd`
2015-04-07 04:47:04 +00:00
2) A _main_ Docker instance which is used for the Kubernetes infrastructure and user's scheduled containers
2015-04-06 23:29:46 +00:00
This pattern is necessary because the `flannel` daemon is responsible for setting up and managing the network that interconnects
2015-04-07 04:47:04 +00:00
all of the Docker containers created by Kubernetes. To achieve this, it must run outside of the _main_ Docker daemon. However,
it is still useful to use containers for deployment and management, so we create a simpler _bootstrap_ daemon to achieve this.
2015-04-06 23:29:46 +00:00
You can specify the version on every node before install:
2015-09-07 06:16:45 +00:00
```sh
export K8S_VERSION=<your_k8s_version (e.g. 1.1.3)>
export ETCD_VERSION=<your_etcd_version (e.g. 2.2.1)>
export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
export FLANNEL_IFACE=<flannel_interface (defaults to eth0)>
2015-09-07 06:16:45 +00:00
```
Otherwise, we'll use latest `hyperkube` image as default k8s version.
2015-04-07 04:47:04 +00:00
## Master Node
2015-07-17 22:35:41 +00:00
2015-04-07 04:47:04 +00:00
The first step in the process is to initialize the master node.
2015-04-06 23:29:46 +00:00
The MASTER_IP step here is optional, it defaults to the first value of `hostname -I`.
Clone the Kubernetes repo, and run [master.sh](docker-multinode/master.sh) on the master machine _with root_:
2015-07-23 03:09:05 +00:00
2015-11-18 08:48:20 +00:00
```console
$ export MASTER_IP=<your_master_ip (e.g. 1.2.3.4)>
$ cd kubernetes/docs/getting-started-guides/docker-multinode/
$ ./master.sh
```
`Master done!`
2015-08-09 18:18:06 +00:00
See [here](docker-multinode/master.md) for detailed instructions explanation.
2015-04-06 23:29:46 +00:00
2015-04-07 04:47:04 +00:00
## Adding a worker node
2015-04-06 23:29:46 +00:00
2015-04-07 04:47:04 +00:00
Once your master is up and running you can add one or more workers on different machines.
2015-04-06 23:29:46 +00:00
Clone the Kubernetes repo, and run [worker.sh](docker-multinode/worker.sh) on the worker machine _with root_:
2015-07-23 03:09:05 +00:00
2015-11-18 08:48:20 +00:00
```console
$ export MASTER_IP=<your_master_ip (e.g. 1.2.3.4)>
$ cd kubernetes/docs/getting-started-guides/docker-multinode/
$ ./worker.sh
```
`Worker done!`
2015-08-09 18:18:06 +00:00
See [here](docker-multinode/worker.md) for detailed instructions explanation.
2015-04-06 23:29:46 +00:00
## Deploy a DNS
See [here](docker-multinode/deployDNS.md) for instructions.
2015-04-07 04:47:04 +00:00
## Testing your cluster
2015-04-06 23:29:46 +00:00
Once your cluster has been created you can [test it out](docker-multinode/testing.md)
2015-07-10 01:02:10 +00:00
For more complete applications, please look in the [examples directory](../../examples/)
2015-07-14 00:13:09 +00:00
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/getting-started-guides/docker-multinode.md?pixel)]()
2015-07-14 00:13:09 +00:00
<!-- END MUNGE: GENERATED_ANALYTICS -->