mirror of https://github.com/k3s-io/k3s
commit
6a98694b4e
|
@ -55,7 +55,7 @@ The only thing you need is a machine with **Docker 1.7.1 or higher**
|
|||
## Overview
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
```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 FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
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:
|
||||
|
||||
```sh
|
||||
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 FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
|
||||
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:
|
||||
|
@ -82,7 +83,7 @@ Run:
|
|||
```sh
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
|
||||
--net=host \
|
||||
gcr.io/google_containers/etcd:${ETCD_VERSION} \
|
||||
gcr.io/google_containers/etcd-amd64:${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 \
|
||||
|
@ -94,7 +95,7 @@ Next, you need to set a CIDR range for flannel. This CIDR should be chosen to b
|
|||
```sh
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock run \
|
||||
--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" }'
|
||||
```
|
||||
|
||||
|
@ -139,7 +140,7 @@ sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
|
|||
--privileged \
|
||||
-v /dev/net:/dev/net \
|
||||
quay.io/coreos/flannel:${FLANNEL_VERSION} \
|
||||
--ip-masq \
|
||||
--ip-masq=${FLANNEL_IPMASQ} \
|
||||
--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!
|
||||
|
||||
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/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/darwin/386/kubectl))
|
||||
([linux/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/amd64/kubectl))
|
||||
([linux/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/386/kubectl))
|
||||
([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/arm/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.7/bin/darwin/386/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.7/bin/linux/386/kubectl))
|
||||
([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/arm/kubectl))
|
||||
|
||||
For example, OS X:
|
||||
|
||||
|
|
|
@ -26,9 +26,10 @@ if ( ! ps -ef | grep "/usr/bin/docker" | grep -v 'grep' &> /dev/null ); then
|
|||
fi
|
||||
|
||||
# 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"}
|
||||
FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"}
|
||||
FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
|
||||
FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"}
|
||||
ARCH=${ARCH:-"amd64"}
|
||||
|
||||
|
@ -47,6 +48,7 @@ echo "K8S_VERSION is set to: ${K8S_VERSION}"
|
|||
echo "ETCD_VERSION is set to: ${ETCD_VERSION}"
|
||||
echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
|
||||
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 "ARCH is set to: ${ARCH}"
|
||||
|
||||
|
@ -120,10 +122,10 @@ DOCKER_CONF=""
|
|||
start_k8s(){
|
||||
# Start etcd
|
||||
docker -H unix:///var/run/docker-bootstrap.sock run \
|
||||
--restart=always \
|
||||
--restart=on-failure \
|
||||
--net=host \
|
||||
-d \
|
||||
gcr.io/google_containers/etcd:${ETCD_VERSION} \
|
||||
gcr.io/google_containers/etcd-${ARCH}:${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 \
|
||||
|
@ -139,14 +141,14 @@ start_k8s(){
|
|||
|
||||
# iface may change to a private network interface, eth0 is for default
|
||||
flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \
|
||||
--restart=always \
|
||||
--restart=on-failure \
|
||||
-d \
|
||||
--net=host \
|
||||
--privileged \
|
||||
-v /dev/net:/dev/net \
|
||||
quay.io/coreos/flannel:${FLANNEL_VERSION} \
|
||||
/opt/bin/flanneld \
|
||||
--ip-masq \
|
||||
--ip-masq="${FLANNEL_IPMASQ}" \
|
||||
--iface="${FLANNEL_IFACE}")
|
||||
|
||||
sleep 8
|
||||
|
@ -200,7 +202,7 @@ start_k8s(){
|
|||
--net=host \
|
||||
--pid=host \
|
||||
--privileged \
|
||||
--restart=always \
|
||||
--restart=on-failure \
|
||||
-d \
|
||||
-v /sys:/sys:ro \
|
||||
-v /var/run:/var/run:rw \
|
||||
|
|
|
@ -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 FLANNEL_VERSION=<your_flannel_version (e.g. 0.5.5)>
|
||||
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:
|
||||
|
@ -105,7 +106,7 @@ sudo docker -H unix:///var/run/docker-bootstrap.sock run -d \
|
|||
-v /dev/net:/dev/net \
|
||||
quay.io/coreos/flannel:${FLANNEL_VERSION} \
|
||||
/opt/bin/flanneld \
|
||||
--ip-masq \
|
||||
--ip-masq=${FLANNEL_IPMASQ} \
|
||||
--etcd-endpoints=http://${MASTER_IP}:4001 \
|
||||
--iface=${FLANNEL_IFACE}
|
||||
```
|
||||
|
|
|
@ -26,9 +26,10 @@ if ( ! ps -ef | grep "/usr/bin/docker" | grep -v 'grep' &> /dev/null ); then
|
|||
fi
|
||||
|
||||
# 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_IFACE=${FLANNEL_IFACE:-"eth0"}
|
||||
FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
|
||||
ARCH=${ARCH:-"amd64"}
|
||||
|
||||
# Run as root
|
||||
|
@ -46,6 +47,7 @@ fi
|
|||
echo "K8S_VERSION is set to: ${K8S_VERSION}"
|
||||
echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
|
||||
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 "ARCH is set to: ${ARCH}"
|
||||
|
||||
|
@ -118,13 +120,13 @@ start_k8s() {
|
|||
# Start flannel
|
||||
flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \
|
||||
-d \
|
||||
--restart=always \
|
||||
--restart=on-failure \
|
||||
--net=host \
|
||||
--privileged \
|
||||
-v /dev/net:/dev/net \
|
||||
quay.io/coreos/flannel:${FLANNEL_VERSION} \
|
||||
/opt/bin/flanneld \
|
||||
--ip-masq \
|
||||
--ip-masq="${FLANNEL_IPMASQ}" \
|
||||
--etcd-endpoints=http://${MASTER_IP}:4001 \
|
||||
--iface="${FLANNEL_IFACE}")
|
||||
|
||||
|
@ -180,7 +182,7 @@ start_k8s() {
|
|||
--net=host \
|
||||
--pid=host \
|
||||
--privileged \
|
||||
--restart=always \
|
||||
--restart=on-failure \
|
||||
-d \
|
||||
-v /sys:/sys:ro \
|
||||
-v /var/run:/var/run:rw \
|
||||
|
@ -203,7 +205,7 @@ start_k8s() {
|
|||
-d \
|
||||
--net=host \
|
||||
--privileged \
|
||||
--restart=always \
|
||||
--restart=on-failure \
|
||||
gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \
|
||||
/hyperkube proxy \
|
||||
--master=http://${MASTER_IP}:8080 \
|
||||
|
|
|
@ -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.
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/darwin/386/kubectl))
|
||||
([linux/amd64](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/amd64/kubectl))
|
||||
([linux/386](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/386/kubectl))
|
||||
([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.6/bin/linux/arm/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.7/bin/darwin/386/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.7/bin/linux/386/kubectl))
|
||||
([linux/arm](http://storage.googleapis.com/kubernetes-release/release/v1.2.0-alpha.7/bin/linux/arm/kubectl))
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
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
|
||||
kubectl get svc nginx
|
||||
|
@ -219,9 +219,8 @@ parameters as follows:
|
|||
output of /proc/cmdline:
|
||||
|
||||
```console
|
||||
$cat /proc/cmdline
|
||||
BOOT_IMAGE=/boot/vmlinuz-3.18.4-aufs root=/dev/sda5 ro cgroup_enable=memory
|
||||
swapaccount=1
|
||||
$ cat /proc/cmdline
|
||||
BOOT_IMAGE=/boot/vmlinuz-3.18.4-aufs root=/dev/sda5 ro cgroup_enable=memory swapaccount=1
|
||||
```
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
|
|
Loading…
Reference in New Issue