Open mfanjie opened 8 years ago
Here is another good blog for k8s cluster setup, with deeper understanding on build and cluster setup https://github.com/zhouhaibing089/Blog/issues
Build: Kubernetes build will be using docker-machine to create a new docker machine named kube-dev, all Kuberenetes builds are inside this machine. As the build requires access to gcr.io to pull images(debian-iptables, pause, kube-registry-proxy), we need to set proxy for this machine. Option 1:Set engine-env when creating the machine using docker-machine create -d virtualbox --engine-env HTTP_PROXY=http://myproxy
diff --git a/build/common.sh b/build/common.sh index 0582911..a70b139 100755 --- a/build/common.sh +++ b/build/common.sh @@ -165,7 +165,10 @@ function kube::build::prepare_docker_machine() { kube::log::status "docker-machine was found." docker-machine inspect kube-dev >/dev/null || { kube::log::status "Creating a machine to build Kubernetes"
Option 2: set global environment variable in Docker file of kube-dev diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile index a3e0f8c..17661b3 100644 --- a/build/build-image/Dockerfile +++ b/build/build-image/Dockerfile @@ -26,6 +26,8 @@ ENV GOARCH amd64 ENV TMPDIR /tmp.k8s
+ENV http_proxy http://myproxy +ENV https_proxy http://myproxy RUN mkdir $TMPDIR && \ go get golang.org/x/tools/cmd/cover github.com/tools/godep
Cluster Bootstrapping When kubernetes provider is set to vagrant, kubernetes will use vagrant to setup the cluster. The master cluster requires connect to gcr.io to pull etcd images, and nodes requires connect to gcr.io to pull etcd as well as other addons. We need to set proxy to the vagrant VM to ensure the connection. Setting up vagrant proxy is most convenient way to do that.
+Vagrant.configure("2") do |config|
refererence http://tmatilai.github.io/vagrant-proxyconf/
After proxy is properly configured, you can boot your cluster by run cluster/kube-up.sh
To accelerate the build, just remove those unnecessary platform. diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 43a1f68..39aeaba 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -50,7 +50,6 @@ readonly KUBE_SERVER_BINARIES=("${KUBE_SERVER_TARGETS[@]##*/}") The server platform we are building on. readonly KUBE_SERVER_PLATFORMS=( linux/amd64
linux/arm )
The set of client targets that we are building for all platforms @@ -101,11 +100,7 @@ readonly KUBE_TEST_PORTABLE=( in 'build/build-image/Dockerfile' readonly KUBE_CLIENT_PLATFORMS=( linux/amd64
As the existence of Chinese GFW, certain required internet accesses are blocked in China. Simply following getting started guide http://kubernetes.io/v1.1/docs/getting-started-guides/vagrant.html will not let you have Kubernetes installed. We need to do a series of hack to make things happen. OS: Mac OS 10.11.2 KUBERNETE_PROVIDER=vagrant