2015-07-12 12:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<!--  BEGIN MUNGE: UNVERSIONED_WARNING  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								<!--  BEGIN STRIP_FOR_RELEASE  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 01:02:26 +08: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-15 02:37:38 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<!--  TAG RELEASE_LINK, added by the munger automatically  --> 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 01:02:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< strong > 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-04 02:17:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								The latest release of this document can be found
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[here ](http://releases.k8s.io/release-1.1/docs/getting-started-guides/docker-multinode/master.md ).
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 01:02:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Documentation for other releases can be found at
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								[releases.k8s.io ](http://releases.k8s.io ).
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								< / strong > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								--
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 06:15:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-12 12:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<!--  END STRIP_FOR_RELEASE  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								<!--  END MUNGE: UNVERSIONED_WARNING  --> 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Installing a Kubernetes Master Node via Docker
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 01:03:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								We'll begin by setting up the master node.  For the purposes of illustration, we'll assume that the IP of this machine
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								is `${MASTER_IP}` .  We'll need to run several versioned Kubernetes components, so we'll assume that the version we want
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								to run is `${K8S_VERSION}` , which should hold a value such as "1.1.3".
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Enviroinment variables used:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								export MASTER_IP=< the_master_ip_here > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								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-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								There are two main phases to installing the master:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								   *  [Setting up `flanneld` and `etcd` ](#setting-up-flanneld-and-etcd )
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								   *  [Starting the Kubernetes master components ](#starting-the-kubernetes-master )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Setting up flanneld and etcd
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 11:58:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								_Note_:
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								This guide expects **Docker 1.7.1 or higher** .
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 11:58:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								### Setup Docker Bootstrap
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								We're going to use `flannel`  to set up networking between Docker daemons.  Flannel itself (and etcd on which it relies) will run inside of
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Docker containers themselves.  To achieve this, we need a separate "bootstrap" instance of the Docker daemon.  This daemon will be started with
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								`--iptables=false`  so that it can only run containers with `--net=host` .  That's sufficient to bootstrap our system.
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Run:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo sh -c 'docker -d -H unix:///var/run/docker-bootstrap.sock -p /var/run/docker-bootstrap.pid --iptables=false --ip-masq=false --bridge=none --graph=/var/lib/docker-bootstrap 2> /var/log/docker-bootstrap.log 1> /dev/null & '
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								_Important Note_:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								If you are running this on a long running system, rather than experimenting, you should run the bootstrap Docker instance under something like SysV init, upstart or systemd so that it is restarted
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								across reboots and failures.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Startup etcd for flannel and the API server to use
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Run:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 10:05:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --net=host \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    gcr.io/google_containers/etcd:${ETCD_VERSION} \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /usr/local/bin/etcd \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --advertise-client-urls=http://${MASTER_IP}:4001 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --data-dir=/var/etcd/data
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Next, you need to set a CIDR range for flannel.  This CIDR should be chosen to be non-overlapping with any existing network you are using:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								sudo docker -H unix:///var/run/docker-bootstrap.sock run \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --net=host \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    gcr.io/google_containers/etcd:${ETCD_VERSION} \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Set up Flannel on the master node
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 10:03:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Flannel is a network abstraction layer build by CoreOS, we will use it to provide simplified networking between our Pods of containers.
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Flannel re-configures the bridge that Docker uses for networking.  As a result we need to stop Docker, reconfigure its networking, and then restart Docker.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#### Bring down Docker
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								To re-configure Docker to use flannel, we need to take docker down, run flannel and then restart Docker.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Turning down Docker is system dependent, it may be:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo /etc/init.d/docker stop
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								or
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo systemctl stop docker
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-11 15:49:01 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								or
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo service docker stop
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								or it may be something else.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#### Run flannel
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Now run flanneld itself:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --net=host \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --privileged \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    -v /dev/net:/dev/net \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    quay.io/coreos/flannel:${FLANNEL_VERSION} \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --ip-masq \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --iface=${FLANNEL_IFACE}
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								The previous command should have printed a really long hash, the container id, copy this hash.
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Now get the subnet settings from flannel:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 10:05:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								sudo docker -H unix:///var/run/docker-bootstrap.sock exec < really-long-hash-from-above-here >  cat /run/flannel/subnet.env
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#### Edit the docker configuration
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								You now need to edit the docker configuration to activate new flags.  Again, this is system specific.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								This may be in `/etc/default/docker`  or `/etc/systemd/service/docker.service`  or it may be elsewhere.
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-11 13:11:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Regardless, you need to add the following to the docker command line:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								--bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#### Remove the existing Docker bridge
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Docker creates a bridge named `docker0`  by default.  You need to remove this:
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo /sbin/ifconfig docker0 down
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo brctl delbr docker0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								You may need to install the `bridge-utils`  package for the `brctl`  binary.
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#### Restart Docker
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Again this is system dependent, it may be:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								sudo /etc/init.d/docker start
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								it may be:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								systemctl start docker
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Starting the Kubernetes Master
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Ok, now that your networking is set up, you can startup Kubernetes, this is the same as the single-node case, we will use the "main" instance of the Docker daemon for the Kubernetes components.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 10:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								sudo docker run \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --volume=/:/rootfs:ro \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --volume=/sys:/sys:ro \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --volume=/dev:/dev \
							 
						 
					
						
							
								
									
										
										
										
											2015-10-17 09:53:04 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    --volume=/var/lib/docker/:/var/lib/docker:rw \
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 10:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    --volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --volume=/var/run:/var/run:rw \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --net=host \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    --privileged=true \
							 
						 
					
						
							
								
									
										
										
										
											2015-11-24 01:19:45 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    --pid=host \
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 10:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    -d \
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    gcr.io/google_containers/hyperkube:v${K8S_VERSION} \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    /hyperkube kubelet \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --allow-privileged=true \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --api-servers=http://localhost:8080 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --v=2 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --address=0.0.0.0 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --enable-server \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --hostname-override=127.0.0.1 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --config=/etc/kubernetes/manifests-multi \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --containerized \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --cluster-dns=10.0.0.10 \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        --cluster-domain=cluster.local
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 05:53:15 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								>  Note that `--cluster-dns` and `--cluster-domain` is used to deploy dns, feel free to discard them if dns is not needed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								### Test it out
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								At this point, you should have a functioning 1-node cluster.  Let's test it out!
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 01:03:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Download the kubectl binary for `${K8S_VERSION}`  (look at the URL in the following links) and make it available by editing your PATH environment variable.
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 22:45:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								([OS X](http://storage.googleapis.com/kubernetes-release/release/v1.1.3/bin/darwin/amd64/kubectl))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								([linux](http://storage.googleapis.com/kubernetes-release/release/v1.1.3/bin/linux/amd64/kubectl))
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 01:03:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								For example, OS X:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```console
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ wget http://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/darwin/amd64/kubectl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ chmod 755 kubectl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ PATH=$PATH:`pwd`
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Linux:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```console
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ wget http://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/linux/amd64/kubectl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ chmod 755 kubectl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								$ PATH=$PATH:`pwd`
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Now you can list the nodes:
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```sh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								kubectl get nodes
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 01:03:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								This should print something like:
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 10:01:02 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 10:05:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								```console
							 
						 
					
						
							
								
									
										
										
										
											2015-06-15 10:38:50 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								NAME        LABELS                             STATUS
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								127.0.0.1   kubernetes.io/hostname=127.0.0.1   Ready
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-19 13:58:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								If the status of the node is `NotReady`  or `Unknown`  please check that all of the containers you created are successfully running.
							 
						 
					
						
							
								
									
										
										
										
											2015-09-03 05:51:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								If all else fails, ask questions on [Slack ](../../troubleshooting.md#slack ).
							 
						 
					
						
							
								
									
										
										
										
											2015-04-07 12:47:04 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Next steps
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-18 06:35:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-14 05:53:15 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Move on to [adding one or more workers ](worker.md ) or [deploy a dns ](deployDNS.md )
							 
						 
					
						
							
								
									
										
										
										
											2015-05-15 06:12:45 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 08:13:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<!--  BEGIN MUNGE: GENERATED_ANALYTICS  --> 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-15 06:12:45 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								[]()
							 
						 
					
						
							
								
									
										
										
										
											2015-07-14 08:13:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								<!--  END MUNGE: GENERATED_ANALYTICS  -->