Merge pull request #2649 from w9n/kube_init

Kubernetes: Autoinit and persistent state by default
This commit is contained in:
Justin Cormack 2017-11-05 14:54:03 +00:00 committed by GitHub
commit 2902764b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -18,6 +18,10 @@ Boot Kubernetes master OS image using `hyperkit` on macOS: or `qemu` on Linux:
``` ```
./boot.sh ./boot.sh
``` ```
or, to automatically initialise the cluster upon boot with no additional options
```
KUBE_MASTER_AUTOINIT="" ./boot.sh
```
Get IP address of the master: Get IP address of the master:
``` ```
@ -29,7 +33,7 @@ Login to the kubelet container:
./ssh_into_kubelet.sh <master-ip> ./ssh_into_kubelet.sh <master-ip>
``` ```
Manually initialise master with `kubeadm`: Manually initialise master with `kubeadm` if booted without `KUBE_MASTER_AUTOINIT`:
``` ```
kubeadm-init.sh kubeadm-init.sh
``` ```

View File

@ -15,7 +15,7 @@ set -e
: ${KUBE_RUN_ARGS:=} : ${KUBE_RUN_ARGS:=}
: ${KUBE_EFI:=} : ${KUBE_EFI:=}
: ${KUBE_MAC:=} : ${KUBE_MAC:=}
: ${KUBE_PRESERVE_STATE:=} : ${KUBE_CLEAR_STATE:=}
[ "$(uname -s)" = "Darwin" ] && KUBE_EFI=1 [ "$(uname -s)" = "Darwin" ] && KUBE_EFI=1
@ -43,7 +43,7 @@ if [ $# -eq 0 ] ; then
: ${KUBE_VCPUS:=$KUBE_MASTER_VCPUS} : ${KUBE_VCPUS:=$KUBE_MASTER_VCPUS}
: ${KUBE_MEM:=$KUBE_MASTER_MEM} : ${KUBE_MEM:=$KUBE_MASTER_MEM}
: ${KUBE_DISK:=$KUBE_MASTER_DISK} : ${KUBE_DISK:=$KUBE_MASTER_DISK}
elif [ $# -gt 1 ] || [ $# -eq 1 -a -n "${KUBE_PRESERVE_STATE}" ] ; then elif [ $# -ge 1 ] ; then
case $1 in case $1 in
''|*[!0-9]*) ''|*[!0-9]*)
echo "Node number must be a number" echo "Node number must be a number"
@ -58,7 +58,11 @@ elif [ $# -gt 1 ] || [ $# -eq 1 -a -n "${KUBE_PRESERVE_STATE}" ] ; then
img="kube-node" img="kube-node"
name="node-${1}" name="node-${1}"
shift shift
if [ $# -ge 1 ] ; then
data="{\"kubeadm\": {\"join\": \"${*}\"} }" data="{\"kubeadm\": {\"join\": \"${*}\"} }"
fi
state="kube-${name}-state" state="kube-${name}-state"
: ${KUBE_VCPUS:=$KUBE_NODE_VCPUS} : ${KUBE_VCPUS:=$KUBE_NODE_VCPUS}
@ -73,7 +77,7 @@ else
exit 1 exit 1
fi fi
set -x set -x
if [ -z "${KUBE_PRESERVE_STATE}" ] ; then if [ -n "${KUBE_CLEAR_STATE}" ] ; then
rm -rf "${state}" rm -rf "${state}"
mkdir "${state}" mkdir "${state}"
if [ -n "${KUBE_MAC}" ] ; then if [ -n "${KUBE_MAC}" ] ; then