From a7da79ad54832fda6281b822401d37d4e108297b Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Fri, 20 Jan 2017 09:22:27 -0800 Subject: [PATCH] Update scripts to add PodCIDR firewall rule for dns --- scripts/bootstrap-controllers.sh | 2 +- scripts/bootstrap-etcd.sh | 4 ++-- scripts/bootstrap-workers.sh | 2 +- scripts/cleanup.sh | 2 +- scripts/create-routes.sh | 4 ++-- scripts/kube-up.sh | 7 ++++++- scripts/setup-ca.sh | 5 +++-- scripts/start-infra-gcp.sh | 9 +++++++-- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/scripts/bootstrap-controllers.sh b/scripts/bootstrap-controllers.sh index fb46e3a..bc4b827 100755 --- a/scripts/bootstrap-controllers.sh +++ b/scripts/bootstrap-controllers.sh @@ -2,7 +2,7 @@ set -x if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then - echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION environment variables" + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" exit 1 fi diff --git a/scripts/bootstrap-etcd.sh b/scripts/bootstrap-etcd.sh index 04230e9..329eece 100755 --- a/scripts/bootstrap-etcd.sh +++ b/scripts/bootstrap-etcd.sh @@ -1,8 +1,8 @@ #!/usr/bin/bash set -x -if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} ]]; then - echo "Must set NUM_CONTROLLERS and NUM_WORKERS environment variables" +if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" exit 1 fi diff --git a/scripts/bootstrap-workers.sh b/scripts/bootstrap-workers.sh index 9f9ded0..c50fe13 100755 --- a/scripts/bootstrap-workers.sh +++ b/scripts/bootstrap-workers.sh @@ -4,7 +4,7 @@ set -x DOCKER_VERSION=1.12.5 if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then - echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION environment variables" + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" exit 1 fi diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 91bc34e..fa5de17 100755 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -32,8 +32,8 @@ gcloud -q compute firewall-rules delete \ kubernetes-allow-healthz \ kubernetes-allow-icmp \ kubernetes-allow-internal \ + kubernetes-allow-internal-podcidr \ kubernetes-allow-rdp \ - kubernetes-nginx-service \ kubernetes-allow-ssh \ kubernetes-nginx-service diff --git a/scripts/create-routes.sh b/scripts/create-routes.sh index df8abf2..79b99f5 100755 --- a/scripts/create-routes.sh +++ b/scripts/create-routes.sh @@ -1,8 +1,8 @@ #!/usr/bin/bash set -x -if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} ]]; then - echo "Must set NUM_CONTROLLERS and NUM_WORKERS environment variables" +if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" exit 1 fi diff --git a/scripts/kube-up.sh b/scripts/kube-up.sh index a519642..eb28cb8 100755 --- a/scripts/kube-up.sh +++ b/scripts/kube-up.sh @@ -2,7 +2,12 @@ set -x if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then - echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION environment variables" + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" + exit 1 +fi + +if [[ ! ${KUBERNETES_VERSION} =~ ^v[0-9].[0-9].[0-9]$ ]]; then + echo "KUBERNETES_VERSION must be in form 'vX.Y.Z'" exit 1 fi diff --git a/scripts/setup-ca.sh b/scripts/setup-ca.sh index 0d11867..54923ff 100755 --- a/scripts/setup-ca.sh +++ b/scripts/setup-ca.sh @@ -1,8 +1,8 @@ #!/usr/bin/bash set -x -if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} ]]; then - echo "Must set NUM_CONTROLLERS and NUM_WORKERS environment variables" +if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" exit 1 fi @@ -114,4 +114,5 @@ done for host in ${kube_hosts}; do gcloud compute copy-files ca.pem kubernetes-key.pem kubernetes.pem ${host}:~/ + sleep 2 done diff --git a/scripts/start-infra-gcp.sh b/scripts/start-infra-gcp.sh index b84407d..fb616c0 100755 --- a/scripts/start-infra-gcp.sh +++ b/scripts/start-infra-gcp.sh @@ -1,8 +1,8 @@ #!/usr/bin/bash set -x -if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} ]]; then - echo "Must set NUM_CONTROLLERS and NUM_WORKERS env vars" +if [[ -z ${NUM_CONTROLLERS} || -z ${NUM_WORKERS} || -z ${KUBERNETES_VERSION} ]]; then + echo "Must set NUM_CONTROLLERS, NUM_WORKERS and KUBERNETES_VERSION (e.g. 'vX.Y.Z') environment variables" exit 1 fi @@ -25,6 +25,11 @@ gcloud compute firewall-rules create kubernetes-allow-internal \ --network kubernetes \ --source-ranges 10.240.0.0/24 +gcloud compute firewall-rules create kubernetes-allow-internal-podcidr \ + --allow tcp:0-65535,udp:0-65535,icmp \ + --network kubernetes \ + --source-ranges 10.200.0.0/16 + gcloud compute firewall-rules create kubernetes-allow-rdp \ --allow tcp:3389 \ --network kubernetes \