Background:
Kubernetes Introduction: http://kubernetes.io/docs/getting-started-guides/
GitHub Address: Https://github.com/kubernetes/kubernetes
Install the documentation on Ubuntu official address: http://kubernetes.io/docs/getting-started-guides/ubuntu/
Environment:
- Master:
- Ubunut14.04
- 192.168.27.135 (NAT)
- Minion1:
- Ubuntu14.04
- 192.168.27.136 (NAT)
- Minion2:
- Ubuntu14.04
- 192.168.27.137 (NAT)
Preparatory work:
You need to install Docker and SSH on three nodes to install SSH:
$ sudo apt-get install openssh-server$ sudo service ssh start
Installing Docker:
sudo apt-get Install Docker-engine
Install Kubernetes:
1. On master, first create a working directory, execute:
$ git clone https://github.com/kubernetes/kubernetes.git
2, after downloading, enter the Kubernetes directory, modify the kubernetes/cluster/ubuntu/config-default.sh file:
[Email protected] 192.168. 127.135 [email protected]192.168. 27.136 [email protected]192.168. 27.137
3, installation kubernetes:
$ cd Kubernetes/cluster
$ kubernetes_provider=ubuntu./kube-up.sh
The following are installed successfully:
Visit page:
The various pits encountered:
1, restart the master node, how to recover?
This problem took me at least 3 hours to get it done, because I was ready to rerun the third step of the previous step, which was to execute the kube-up.sh again, but I found that every time the script downloaded Etcd, Flanneld, and kubernetes packages from GitHub, This bag is 1.4G in size, it is conceivable how much time to delay. Then I can only slowly find out where this script is executed, and finally found in the kubernetes/cluster/ubuntu/under the download-release.sh, that is, in the file. So I changed the contents of the file and changed it to look like in the code below to keep it from going down every time. Then, my practice is to back up the first successful installation of the file, that is, kubernetes/cluster/ubuntu/binaries this directory back up, and then directly to the reboot of the corresponding directory of the master. Then execute the kube-up.sh, then OK!
#!/bin/bash# Copyright -the Kubernetes Authors All rights reserved.## Licensed under the Apache License, Version2.0(The"License"); ThisFile exceptinchcompliance with the license.# obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0# # unless required by applicable law or agreed toinchwriting, software# distributed under the License isDistributed on an" as is"basis,# without warranties or CONDITIONS of any KIND, either express or implied.# see the License forThe specific language governing permissions and# limitations under the license.# Download the ETCD, flannel, and k8s binaries automatically and storedinchbinaries directory# Run asRoot only# author @resouer @WIZARD-CxySet-e#function Cleanup {# cleanup work #rm-RF flannel* kubernetes* etcd*binaries#} #trap cleanup SIGHUP SIGINT sigtermpushd $ (dirname $0) mkdir-P binaries/Mastermkdir-P binaries/minion# flannelflannel_version=${flannel_version:-"0.5.5"}echo"Prepare Flannel ${flannel_version} release ..."grep-Q"^${flannel_version}\$"Binaries/.flannel2>/dev/NULL||{# Curl-L https://github.com/coreos/flannel/releases/download/v${flannel_version}/flannel-${flannel_version}- Linux-amd64.tar.gz-o flannel.tar.gz# tar XZF flannel.tar.gz# cp Flannel-${flannel_version}/flanneld binaries/Master # CP Flannel-${flannel_version}/flanneld binaries/minion Echo ${flannel_version}> binaries/. flannel}# ectdetcd_version=${etcd_version:-"2.3.1"}etcd="Etcd-v${etcd_version}-linux-amd64"Echo"Prepare etcd ${etcd_version} release ..."grep-Q"^${etcd_version}\$"Binaries/.etcd2>/dev/NULL||{# Curl-L https://Github.com/coreos/etcd/releases/download/v${etcd_version}/${etcd}.tar.gz-o etcd.tar.gz# tar XZF etcd.tar.gz# cp ${etcd}/ETCD ${etcd}/etcdctl binaries/master echo ${etcd_version}> binaries/. etcd}function Get_latest_version_number {Local-R latest_url="Https://storage.googleapis.com/kubernetes-release/release/stable.txt" if[[$ (which wget)]]; then wget-qo-${latest_url} elif [[$ (which curl)]]; then Curl-Ss ${latest_url}ElseEcho"couldn ' t find curl or wget. Bailing out.">&2Exit4fi} Kube_version=$ (get_latest_version_number | sed's/^v//') # K8secho"Prepare kubernetes ${kube_version} release ..."grep-Q"^${kube_version}\$"Binaries/.kubernetes2>/dev/NULL||{# Curl-L https://Github.com/kubernetes/kubernetes/releases/download/v${kube_version}/kubernetes.tar.gz-o kubernetes.tar.gz # tar xzf kubernetes.tar.gz# pushd kubernetes/server# tar xzf kubernetes-server-linux-amd64.tar.gz# popd# CP kubernetes/server/kubernetes/server/bin/kube-Apiserver # kubernetes/server/kubernetes/server/bin/kube-controller-Manager # Kubernetes/server/kubernetes/server/bin/kube-scheduler binaries/master# CP kubernetes/server/kubernetes/server/bin/Kubelet # kubernetes/server/kubernetes/server/bin/kube-proxy binaries/minion# CP kubernetes/server/kubernetes/server/bin/kubectl binaries/Echo ${kube_version}> binaries/. kubernetes} #rm-RF flannel* kubernetes* etcd*Echo"done! All your binaries locate in Kubernetes/cluster/ubuntu/binaries directory"popd
"Kubernetes" ubuntu14.04 64-bit construction kubernetes process