|
1 |
| ---- |
2 |
| -title: Portable Multi-Node Cluster |
3 |
| ---- |
4 |
| - |
5 |
| -* TOC |
6 |
| -{:toc} |
7 |
| - |
8 |
| - |
9 |
| -## Prerequisites |
10 |
| - |
11 |
| -The only thing you need is a linux machine with **Docker 1.10.0 or higher** |
12 |
| - |
13 |
| -## Overview |
14 |
| - |
15 |
| -This guide will set up a 2-node Kubernetes cluster, consisting of a _master_ node which hosts the API server and orchestrates work |
16 |
| -and a _worker_ node which receives work from the master. You can repeat the process of adding worker nodes an arbitrary number of |
17 |
| -times to create larger clusters. |
18 |
| - |
19 |
| -Here's a diagram of what the final result will look like: |
20 |
| - |
21 |
| - |
22 |
| -### Bootstrap Docker |
23 |
| - |
24 |
| -This guide uses a pattern of running two instances of the Docker daemon: |
25 |
| - 1) A _bootstrap_ Docker instance which is used to start `etcd` and `flanneld`, on which the Kubernetes components depend |
26 |
| - 2) A _main_ Docker instance which is used for the Kubernetes infrastructure and user's scheduled containers |
27 |
| - |
28 |
| -This pattern is necessary because the `flannel` daemon is responsible for setting up and managing the network that interconnects |
29 |
| -all of the Docker containers created by Kubernetes. To achieve this, it must run outside of the _main_ Docker daemon. However, |
30 |
| -it is still useful to use containers for deployment and management, so we create a simpler _bootstrap_ daemon to achieve this. |
31 |
| - |
32 |
| -### Versions supported |
33 |
| - |
34 |
| -v1.2.x and v1.3.x are supported versions for this deployment. |
35 |
| -v1.3.0 alphas and betas might work, but be sure you know what you're doing if you're trying them out. |
36 |
| - |
37 |
| -### Multi-arch solution |
38 |
| - |
39 |
| -Yeah, it's true. You may run this deployment setup seamlessly on `amd64`, `arm`, `arm64` and `ppc64le` hosts. |
40 |
| -See this tracking issue for more details: https://github.com/kubernetes/kubernetes/issues/17981 |
41 |
| - |
42 |
| -v1.3.0 ships with support for amd64, arm and arm64. ppc64le isn't supported, due to a bug in the Go runtime, `hyperkube` (only!) isn't built for the stable v1.3.0 release, and therefore this guide can't run it. But you may still run Kubernetes on ppc64le via custom deployments. |
43 |
| - |
44 |
| -hyperkube was pushed for ppc64le at versions `v1.3.0-alpha.3` and `v1.3.0-alpha.4`, feel free to try them out, but there might be some unexpected bugs. |
45 |
| - |
46 |
| -### Options/configuration |
47 |
| - |
48 |
| -The scripts will output something like this when starting: |
49 |
| - |
50 |
| -```shell |
51 |
| -+++ [0611 12:50:12] K8S_VERSION is set to: v1.3.0 |
52 |
| -+++ [0611 12:50:12] ETCD_VERSION is set to: 2.2.5 |
53 |
| -+++ [0611 12:50:12] FLANNEL_VERSION is set to: 0.5.5 |
54 |
| -+++ [0611 12:50:12] FLANNEL_IPMASQ is set to: true |
55 |
| -+++ [0611 12:50:12] FLANNEL_NETWORK is set to: 10.1.0.0/16 |
56 |
| -+++ [0611 12:50:12] FLANNEL_BACKEND is set to: udp |
57 |
| -+++ [0611 12:50:12] RESTART_POLICY is set to: unless-stopped |
58 |
| -+++ [0611 12:50:12] MASTER_IP is set to: 192.168.1.50 |
59 |
| -+++ [0611 12:50:12] ARCH is set to: amd64 |
60 |
| -+++ [0611 12:50:12] NET_INTERFACE is set to: eth0 |
61 |
| -``` |
62 |
| - |
63 |
| -Each of these options are overridable by `export`ing the values before running the script. |
64 |
| - |
65 |
| -## Setup the master node |
66 |
| - |
67 |
| -The first step in the process is to initialize the master node. |
68 |
| - |
69 |
| -Clone the `kube-deploy` repo, and run `master.sh` on the master machine _with root_: |
70 |
| - |
71 |
| -```shell |
72 |
| -$ git clone https://github.com/kubernetes/kube-deploy |
73 |
| -$ cd kube-deploy/docker-multinode |
74 |
| -$ ./master.sh |
75 |
| -``` |
76 |
| - |
77 |
| -First, the `bootstrap` docker daemon is started, then `etcd` and `flannel` are started as containers in the bootstrap daemon. |
78 |
| -Then, the main docker daemon is restarted, and this is an OS/distro-specific tasks, so if it doesn't work for your distro, feel free to contribute! |
79 |
| - |
80 |
| -Lastly, it launches `kubelet` in the main docker daemon, and the `kubelet` in turn launches the control plane (apiserver, controller-manager and scheduler) as static pods. |
81 |
| - |
82 |
| -## Adding a worker node |
83 |
| - |
84 |
| -Once your master is up and running you can add one or more workers on different machines. |
85 |
| - |
86 |
| -Clone the `kube-deploy` repo, and run `worker.sh` on the worker machine _with root_: |
87 |
| - |
88 |
| -```shell |
89 |
| -$ git clone https://github.com/kubernetes/kube-deploy |
90 |
| -$ cd kube-deploy/docker-multinode |
91 |
| -$ export MASTER_IP=${SOME_IP} |
92 |
| -$ ./worker.sh |
93 |
| -``` |
94 |
| - |
95 |
| -First, the `bootstrap` docker daemon is started, then `flannel` is started as a container in the bootstrap daemon, in order to set up the overlay network. |
96 |
| -Then, the main docker daemon is restarted and lastly `kubelet` is launched as a container in the main docker daemon. |
97 |
| - |
98 |
| -## Addons |
99 |
| - |
100 |
| -kube-dns and the dashboard are deployed automatically with v1.3.0 |
101 |
| - |
102 |
| -### Deploy DNS manually for v1.2.x |
103 |
| - |
104 |
| -Just specify the architecture, and deploy via these commands: |
105 |
| - |
106 |
| -```shell |
107 |
| -# Possible options: amd64, arm, arm64 and ppc64le |
108 |
| -$ export ARCH=amd64 |
109 |
| - |
110 |
| -# If the kube-system namespace isn't already created, create it |
111 |
| -$ kubectl get ns |
112 |
| -$ kubectl create namespace kube-system |
113 |
| - |
114 |
| -$ sed -e "s/ARCH/${ARCH}/g;" skydns.yaml | kubectl create -f - |
115 |
| -``` |
116 |
| - |
117 |
| -### Test if DNS works |
118 |
| - |
119 |
| -Follow [this link](https://releases.k8s.io/release-1.2/cluster/addons/dns#how-do-i-test-if-it-is-working) to check it out. |
| 1 | +# Stop. This guide has been superseded by [kubeadm](../kubeadm/). This page is only present for historical purposes. |
0 commit comments