Merge pull request #20483 from luxas/remove_restart_always

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-02-06 16:43:40 -08:00
commit 6a98694b4e
6 changed files with 40 additions and 34 deletions

View File

@ -55,7 +55,7 @@ The only thing you need is a machine with **Docker 1.7.1 or higher**
## Overview ## Overview
This guide will set up a 2-node Kubernetes cluster, consisting of a _master_ node which hosts the API server and orchestrates work This guide will set up a 2-node Kubernetes cluster, consisting of a _master_ node which hosts the API server and orchestrates work
and a _worker_ node which receives work from the master. You can repeat the process of adding worker nodes an arbitrary number of 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. times to create larger clusters.
Here's a diagram of what the final result will look like: Here's a diagram of what the final result will look like:
@ -74,10 +74,11 @@ it is still useful to use containers for deployment and management, so we create
You can specify the version on every node before install: You can specify the version on every node before install:
```sh ```sh
export K8S_VERSION=<your_k8s_version (e.g. 1.2.0-alpha.6)> export K8S_VERSION=<your_k8s_version (e.g. 1.2.0-alpha.7)>
export ETCD_VERSION=<your_etcd_version (e.g. 2.2.1)> export ETCD_VERSION=<your_etcd_version (e.g. 2.2.1)>
export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)> export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
export FLANNEL_IFACE=<flannel_interface (defaults to eth0)> export FLANNEL_IFACE=<flannel_interface (defaults to eth0)>
export FLANNEL_IPMASQ=<flannel_ipmasq_flag (defaults to true)>
``` ```
Otherwise, we'll use latest `hyperkube` image as default k8s version. Otherwise, we'll use latest `hyperkube` image as default k8s version.

View File

@ -36,16 +36,17 @@ Documentation for other releases can be found at
We'll begin by setting up the master node. For the purposes of illustration, we'll assume that the IP of this machine 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 is `${MASTER_IP}`. We'll need to run several versioned Kubernetes components, so we'll assume that the version we want
to run is `${K8S_VERSION}`, which should hold a released version of Kubernetes >= "1.2.0-alpha.6" to run is `${K8S_VERSION}`, which should hold a released version of Kubernetes >= "1.2.0-alpha.7"
Enviroinment variables used: Enviroinment variables used:
```sh ```sh
export MASTER_IP=<the_master_ip_here> export MASTER_IP=<the_master_ip_here>
export K8S_VERSION=<your_k8s_version (e.g. 1.2.0-alpha.6)> export K8S_VERSION=<your_k8s_version (e.g. 1.2.0-alpha.7)>
export ETCD_VERSION=<your_etcd_version (e.g. 2.2.1)> export ETCD_VERSION=<your_etcd_version (e.g. 2.2.1)>
export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)> export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
export FLANNEL_IFACE=<flannel_interface (defaults to eth0)> export FLANNEL_IFACE=<flannel_interface (defaults to eth0)>
export FLANNEL_IPMASQ=<flannel_ipmasq_flag (defaults to true)>
``` ```
There are two main phases to installing the master: There are two main phases to installing the master:
@ -82,7 +83,7 @@ Run:
```sh ```sh
sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \ sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
--net=host \ --net=host \
gcr.io/google_containers/etcd:${ETCD_VERSION} \ gcr.io/google_containers/etcd-amd64:${ETCD_VERSION} \
/usr/local/bin/etcd \ /usr/local/bin/etcd \
--listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \ --listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \
--advertise-client-urls=http://${MASTER_IP}:4001 \ --advertise-client-urls=http://${MASTER_IP}:4001 \
@ -94,7 +95,7 @@ Next, you need to set a CIDR range for flannel. This CIDR should be chosen to b
```sh ```sh
sudo docker -H unix:///var/run/docker-bootstrap.sock run \ sudo docker -H unix:///var/run/docker-bootstrap.sock run \
--net=host \ --net=host \
gcr.io/google_containers/etcd:${ETCD_VERSION} \ gcr.io/google_containers/etcd-amd64:${ETCD_VERSION} \
etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }' etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
``` ```
@ -139,7 +140,7 @@ sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
--privileged \ --privileged \
-v /dev/net:/dev/net \ -v /dev/net:/dev/net \
quay.io/coreos/flannel:${FLANNEL_VERSION} \ quay.io/coreos/flannel:${FLANNEL_VERSION} \
--ip-masq \ --ip-masq=${FLANNEL_IPMASQ} \
--iface=${FLANNEL_IFACE} --iface=${FLANNEL_IFACE}
``` ```
@ -225,11 +226,11 @@ sudo docker run \
At this point, you should have a functioning 1-node cluster. Let's test it out! At this point, you should have a functioning 1-node cluster. Let's test it out!
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. 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.
([OS X/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/darwin/amd64/kubectl)) ([OS X/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/darwin/amd64/kubectl))
([OS X/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/darwin/386/kubectl)) ([OS X/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/darwin/386/kubectl))
([linux/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/amd64/kubectl)) ([linux/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/amd64/kubectl))
([linux/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/386/kubectl)) ([linux/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/386/kubectl))
([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/arm/kubectl)) ([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/arm/kubectl))
For example, OS X: For example, OS X:

View File

@ -26,9 +26,10 @@ if ( ! ps -ef | grep "/usr/bin/docker" | grep -v 'grep' &> /dev/null ); then
fi fi
# Make sure k8s version env is properly set # Make sure k8s version env is properly set
K8S_VERSION=${K8S_VERSION:-"1.2.0-alpha.6"} K8S_VERSION=${K8S_VERSION:-"1.2.0-alpha.7"}
ETCD_VERSION=${ETCD_VERSION:-"2.2.1"} ETCD_VERSION=${ETCD_VERSION:-"2.2.1"}
FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"} FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"}
FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"} FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"}
ARCH=${ARCH:-"amd64"} ARCH=${ARCH:-"amd64"}
@ -47,6 +48,7 @@ echo "K8S_VERSION is set to: ${K8S_VERSION}"
echo "ETCD_VERSION is set to: ${ETCD_VERSION}" echo "ETCD_VERSION is set to: ${ETCD_VERSION}"
echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}" echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
echo "FLANNEL_IFACE is set to: ${FLANNEL_IFACE}" echo "FLANNEL_IFACE is set to: ${FLANNEL_IFACE}"
echo "FLANNEL_IPMASQ is set to: ${FLANNEL_IPMASQ}"
echo "MASTER_IP is set to: ${MASTER_IP}" echo "MASTER_IP is set to: ${MASTER_IP}"
echo "ARCH is set to: ${ARCH}" echo "ARCH is set to: ${ARCH}"
@ -120,10 +122,10 @@ DOCKER_CONF=""
start_k8s(){ start_k8s(){
# Start etcd # Start etcd
docker -H unix:///var/run/docker-bootstrap.sock run \ docker -H unix:///var/run/docker-bootstrap.sock run \
--restart=always \ --restart=on-failure \
--net=host \ --net=host \
-d \ -d \
gcr.io/google_containers/etcd:${ETCD_VERSION} \ gcr.io/google_containers/etcd-${ARCH}:${ETCD_VERSION} \
/usr/local/bin/etcd \ /usr/local/bin/etcd \
--listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \ --listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \
--advertise-client-urls=http://${MASTER_IP}:4001 \ --advertise-client-urls=http://${MASTER_IP}:4001 \
@ -139,14 +141,14 @@ start_k8s(){
# iface may change to a private network interface, eth0 is for default # iface may change to a private network interface, eth0 is for default
flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \ flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \
--restart=always \ --restart=on-failure \
-d \ -d \
--net=host \ --net=host \
--privileged \ --privileged \
-v /dev/net:/dev/net \ -v /dev/net:/dev/net \
quay.io/coreos/flannel:${FLANNEL_VERSION} \ quay.io/coreos/flannel:${FLANNEL_VERSION} \
/opt/bin/flanneld \ /opt/bin/flanneld \
--ip-masq \ --ip-masq="${FLANNEL_IPMASQ}" \
--iface="${FLANNEL_IFACE}") --iface="${FLANNEL_IFACE}")
sleep 8 sleep 8
@ -200,7 +202,7 @@ start_k8s(){
--net=host \ --net=host \
--pid=host \ --pid=host \
--privileged \ --privileged \
--restart=always \ --restart=on-failure \
-d \ -d \
-v /sys:/sys:ro \ -v /sys:/sys:ro \
-v /var/run:/var/run:rw \ -v /var/run:/var/run:rw \

View File

@ -47,6 +47,7 @@ export MASTER_IP=<the_master_ip_here>
export K8S_VERSION=<your_k8s_version (e.g. 1.2.0-alpha.6)> export K8S_VERSION=<your_k8s_version (e.g. 1.2.0-alpha.6)>
export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)> export FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
export FLANNEL_IFACE=<flannel_interface (defaults to eth0)> export FLANNEL_IFACE=<flannel_interface (defaults to eth0)>
export FLANNEL_IPMASQ=<flannel_ipmasq_flag (defaults to true)>
``` ```
For each worker node, there are three steps: For each worker node, there are three steps:
@ -105,7 +106,7 @@ sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
-v /dev/net:/dev/net \ -v /dev/net:/dev/net \
quay.io/coreos/flannel:${FLANNEL_VERSION} \ quay.io/coreos/flannel:${FLANNEL_VERSION} \
/opt/bin/flanneld \ /opt/bin/flanneld \
--ip-masq \ --ip-masq=${FLANNEL_IPMASQ} \
--etcd-endpoints=http://${MASTER_IP}:4001 \ --etcd-endpoints=http://${MASTER_IP}:4001 \
--iface=${FLANNEL_IFACE} --iface=${FLANNEL_IFACE}
``` ```

View File

@ -26,9 +26,10 @@ if ( ! ps -ef | grep "/usr/bin/docker" | grep -v 'grep' &> /dev/null ); then
fi fi
# Make sure k8s version env is properly set # Make sure k8s version env is properly set
K8S_VERSION=${K8S_VERSION:-"1.2.0-alpha.6"} K8S_VERSION=${K8S_VERSION:-"1.2.0-alpha.7"}
FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"} FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"}
FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"} FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"}
FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
ARCH=${ARCH:-"amd64"} ARCH=${ARCH:-"amd64"}
# Run as root # Run as root
@ -46,6 +47,7 @@ fi
echo "K8S_VERSION is set to: ${K8S_VERSION}" echo "K8S_VERSION is set to: ${K8S_VERSION}"
echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}" echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
echo "FLANNEL_IFACE is set to: ${FLANNEL_IFACE}" echo "FLANNEL_IFACE is set to: ${FLANNEL_IFACE}"
echo "FLANNEL_IPMASQ is set to: ${FLANNEL_IPMASQ}"
echo "MASTER_IP is set to: ${MASTER_IP}" echo "MASTER_IP is set to: ${MASTER_IP}"
echo "ARCH is set to: ${ARCH}" echo "ARCH is set to: ${ARCH}"
@ -118,13 +120,13 @@ start_k8s() {
# Start flannel # Start flannel
flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \ flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \
-d \ -d \
--restart=always \ --restart=on-failure \
--net=host \ --net=host \
--privileged \ --privileged \
-v /dev/net:/dev/net \ -v /dev/net:/dev/net \
quay.io/coreos/flannel:${FLANNEL_VERSION} \ quay.io/coreos/flannel:${FLANNEL_VERSION} \
/opt/bin/flanneld \ /opt/bin/flanneld \
--ip-masq \ --ip-masq="${FLANNEL_IPMASQ}" \
--etcd-endpoints=http://${MASTER_IP}:4001 \ --etcd-endpoints=http://${MASTER_IP}:4001 \
--iface="${FLANNEL_IFACE}") --iface="${FLANNEL_IFACE}")
@ -180,7 +182,7 @@ start_k8s() {
--net=host \ --net=host \
--pid=host \ --pid=host \
--privileged \ --privileged \
--restart=always \ --restart=on-failure \
-d \ -d \
-v /sys:/sys:ro \ -v /sys:/sys:ro \
-v /var/run:/var/run:rw \ -v /var/run:/var/run:rw \
@ -203,7 +205,7 @@ start_k8s() {
-d \ -d \
--net=host \ --net=host \
--privileged \ --privileged \
--restart=always \ --restart=on-failure \
gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \ gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \
/hyperkube proxy \ /hyperkube proxy \
--master=http://${MASTER_IP}:8080 \ --master=http://${MASTER_IP}:8080 \

View File

@ -58,7 +58,7 @@ Here's a diagram of what the final result will look like:
1. You need to have docker installed on one machine. 1. You need to have docker installed on one machine.
2. Decide what Kubernetes version to use. Set the `${K8S_VERSION}` variable to 2. Decide what Kubernetes version to use. Set the `${K8S_VERSION}` variable to
a released version of Kubernetes >= "1.2.0-alpha.6" a released version of Kubernetes >= "1.2.0-alpha.7"
### Run it ### Run it
@ -96,11 +96,11 @@ At this point you should have a running Kubernetes cluster. You can test this
by downloading the kubectl binary for `${K8S_VERSION}` (look at the URL in the by downloading the kubectl binary for `${K8S_VERSION}` (look at the URL in the
following links) and make it available by editing your PATH environment following links) and make it available by editing your PATH environment
variable. variable.
([OS X/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/darwin/amd64/kubectl)) ([OS X/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/darwin/amd64/kubectl))
([OS X/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/darwin/386/kubectl)) ([OS X/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/darwin/386/kubectl))
([linux/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/amd64/kubectl)) ([linux/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/amd64/kubectl))
([linux/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/386/kubectl)) ([linux/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/386/kubectl))
([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/arm/kubectl)) ([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/arm/kubectl))
For example, OS X: For example, OS X:
@ -159,7 +159,7 @@ Now run `docker ps` you should see nginx running. You may need to wait a few mi
kubectl expose rc nginx --port=80 kubectl expose rc nginx --port=80
``` ```
Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (CLUSTER_IP), and the second one is the external load-balanced IP. Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (CLUSTER_IP), and the second one is the external load-balanced IP (if a LoadBalancer is configured)
```sh ```sh
kubectl get svc nginx kubectl get svc nginx
@ -219,9 +219,8 @@ parameters as follows:
output of /proc/cmdline: output of /proc/cmdline:
```console ```console
$cat /proc/cmdline $ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-3.18.4-aufs root=/dev/sda5 ro cgroup_enable=memory BOOT_IMAGE=/boot/vmlinuz-3.18.4-aufs root=/dev/sda5 ro cgroup_enable=memory swapaccount=1
swapaccount=1
``` ```
<!-- BEGIN MUNGE: GENERATED_ANALYTICS --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->