上个月Kubernetes发布了1.5.1, 在k8s1.4.1的版本时我整理了一个简单的脚本只是把安装中原本就不多的步骤集中了起来,本文将继续使用
https://github.com/liumiaocn/easypack/tree/master/k8s上面提供的脚本确认kubernetes1.5.1的安装。
项番 | 详细 |
---|---|
No.1 | 一台或多台CentOS7 |
No.2 | 大于或等于1G的内存 |
No.3 | 网络可以连接 |
Package | 版本 |
---|---|
kubectl | 1.5.1-0.x86_64 |
kubernetes-cni | 0.3.0.1-0.07a8a2.x86_64 |
docker | 1.10.3-59.el7 |
kubelet | 1.5.1-0.x86_64 |
kubeadm | 1.6.0-0.alpha.0.2074.a092d8e0f95f52 |
Kubernetes建议Docker的版本使用1.12.2, 但是像1.10.3和v1.12.1也能正常动作,本文就使用centos7.1标配的1.10.3
kubernetes1.4.1和kubernetes1.5.1所需要相关镜像的版本信息如下所示
镜像 | kubernetes1.4.1 | kubernetes1.5.1 |
---|---|---|
kube-proxy-amd64 | v1.4.1 | v1.5.1 |
kube-discovery-amd64 | 1.0 | 1.0 |
kube-scheduler-amd64 | v1.4.1 | v1.5.1 |
kube-controller-manager-amd64 | v1.4.1 | v1.5.1 |
kube-apiserver-amd64 | v1.4.1 | v1.5.1 |
pause-amd64 | 3.0 | 3.0 |
etcd-amd64 | 2.2.5 | 3.0.14-kubeadm |
kubedns-amd64 | 1.7 | 1.9 |
kube-dnsmasq-amd64 | 1.3 | 1.4 |
exechealthz-amd64 | 1.1 | 1.2 |
kubernetes-dashboard-amd64 | v1.4.1 | v1.5.1 |
dnsmasq-metrics-amd64 | 1.0 |
本文继续使用easypack下面的脚本(easypack_kubernetes_1.5.1_nowall.sh)进行安装kubernetes1.5.1。因为Package部分有些源无法找到稳定的场所,所以验证使用了kubernetes官网提供的baseurl(http://yum.kubernetes.io/repos/kubernetes-el7-x86_64),如果无法访问的话请脚本中此部分替换为稳定可以访问的yum源。
clone
Master节点和Node节点都需要
git clone https://github.com/liumiaocn/easypack
Master节点作以下操作
cd easypack/k8s
sh easypack_kubernetes_1.5.1_nowall.sh MASTER
Node节点作以下操作
git clone https://github.com/liumiaocn/easypack
cd easypack/k8s
sh easypack_kubernetes.sh NODE token MASTERIP
安装总时间30分钟,其中下载google相关镜像25分钟左右。网速慢的只好自求多福吧。
[root@host31 tmp]# sh /tmp/easypack_kubernetes_1.5.1_nowall.sh MASTER
Fri Jan 6 08:04:58 EST 2017
##INSTALL LOG : /tmp/k8s_install.4470.log
##Step 1: Stop firewall ...
Fri Jan 6 08:04:58 EST 2017
##Step 2: set repository and install kubeadm etc...
install kubectl in Master...
#######Set docker proxy when needed. If ready, press any to continue...
此处会暂停,为那些需要为docker设定代理服务器的情况下,设定完毕之后回车,如果不需要的话,直接回车即可。
Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /etc/systemd/system/kubelet.service.
Fri Jan 6 08:07:32 EST 2017
##Step 3: pull google containers...
Now begin to pull images from liumiaocn
No.1 : kube-proxy-amd64:v1.5.1 pull begins ...
No.1 : kube-proxy-amd64:v1.5.1 pull ends ...
No.1 : kube-proxy-amd64:v1.5.1 rename ...
No.1 : kube-proxy-amd64:v1.5.1 untag ...
No.2 : kube-discovery-amd64:1.0 pull begins ...
No.2 : kube-discovery-amd64:1.0 pull ends ...
No.2 : kube-discovery-amd64:1.0 rename ...
No.2 : kube-discovery-amd64:1.0 untag ...
No.3 : kube-scheduler-amd64:v1.5.1 pull begins ...
No.3 : kube-scheduler-amd64:v1.5.1 pull ends ...
No.3 : kube-scheduler-amd64:v1.5.1 rename ...
No.3 : kube-scheduler-amd64:v1.5.1 untag ...
No.4 : kube-controller-manager-amd64:v1.5.1 pull begins ...
No.4 : kube-controller-manager-amd64:v1.5.1 pull ends ...
No.4 : kube-controller-manager-amd64:v1.5.1 rename ...
No.4 : kube-controller-manager-amd64:v1.5.1 untag ...
No.5 : kube-apiserver-amd64:v1.5.1 pull begins ...
No.5 : kube-apiserver-amd64:v1.5.1 pull ends ...
No.5 : kube-apiserver-amd64:v1.5.1 rename ...
No.5 : kube-apiserver-amd64:v1.5.1 untag ...
No.6 : pause-amd64:3.0 pull begins ...
No.6 : pause-amd64:3.0 pull ends ...
No.6 : pause-amd64:3.0 rename ...
No.6 : pause-amd64:3.0 untag ...
No.7 : etcd-amd64:3.0.14-kubeadm pull begins ...
No.7 : etcd-amd64:3.0.14-kubeadm pull ends ...
No.7 : etcd-amd64:3.0.14-kubeadm rename ...
No.7 : etcd-amd64:3.0.14-kubeadm untag ...
No.8 : kubedns-amd64:1.9 pull begins ...
No.8 : kubedns-amd64:1.9 pull ends ...
No.8 : kubedns-amd64:1.9 rename ...
No.8 : kubedns-amd64:1.9 untag ...
No.9 : kube-dnsmasq-amd64:1.4 pull begins ...
No.9 : kube-dnsmasq-amd64:1.4 pull ends ...
No.9 : kube-dnsmasq-amd64:1.4 rename ...
No.9 : kube-dnsmasq-amd64:1.4 untag ...
No.10 : exechealthz-amd64:1.2 pull begins ...
No.10 : exechealthz-amd64:1.2 pull ends ...
No.10 : exechealthz-amd64:1.2 rename ...
No.10 : exechealthz-amd64:1.2 untag ...
No.11 : kubernetes-dashboard-amd64:v1.5.1 pull begins ...
No.11 : kubernetes-dashboard-amd64:v1.5.1 pull ends ...
No.11 : kubernetes-dashboard-amd64:v1.5.1 rename ...
No.11 : kubernetes-dashboard-amd64:v1.5.1 untag ...
No.12 : dnsmasq-metrics-amd64:1.0 pull begins ...
No.12 : dnsmasq-metrics-amd64:1.0 pull ends ...
No.12 : dnsmasq-metrics-amd64:1.0 rename ...
No.12 : dnsmasq-metrics-amd64:1.0 untag ...
All images have been pulled to local as following
gcr.io/google_containers/kube-controller-manager-amd64 v1.5.1 cd5684031720 3 weeks ago 102.4 MB
gcr.io/google_containers/kube-apiserver-amd64 v1.5.1 8c12509df629 3 weeks ago 124.1 MB
gcr.io/google_containers/kube-scheduler-amd64 v1.5.1 6506e7b74dac 3 weeks ago 53.97 MB
gcr.io/google_containers/kube-proxy-amd64 v1.5.1 71d2b27b03f6 3 weeks ago 175.6 MB
gcr.io/google_containers/etcd-amd64 3.0.14-kubeadm 856e39ac7be3 6 weeks ago 174.9 MB
gcr.io/google_containers/kubedns-amd64 1.9 26cf1ed9b144 6 weeks ago 47 MB
gcr.io/google_containers/kubernetes-dashboard-amd64 v1.5.1 c0e4ba8968ee 9 weeks ago 89.49 MB
gcr.io/google_containers/kube-dnsmasq-amd64 1.4 3ec65756a89b 3 months ago 5.126 MB
gcr.io/google_containers/kube-discovery-amd64 1.0 c5e0c9a457fc 3 months ago 134.2 MB
gcr.io/google_containers/pause-amd64 3.0 99e59f495ffa 8 months ago 746.9 kB
Fri Jan 6 08:32:08 EST 2017
Fri Jan 6 08:32:08 EST 2017
##Step 4: kubeadm init
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
[preflight] Running pre-flight checks
[init] Using Kubernetes version: v1.5.1
[tokens] Generated token: "eb97c5.c75bdb13c260f797"
[certificates] Generated Certificate Authority key and certificate.
[certificates] Generated API Server key and certificate
[certificates] Generated Service Account signing keys
[certificates] Created keys and certificates in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 112.316013 seconds
[apiclient] Waiting for at least one node to register and become ready
[apiclient] First node is ready after 10.373614 seconds
[apiclient] Creating a test deployment
[apiclient] Test deployment succeeded
[token-discovery] Created the kube-discovery deployment, waiting for it to become ready
[token-discovery] kube-discovery is ready after 15.055928 seconds
[addons] Created essential addon: kube-proxy
[addons] Created essential addon: kube-dns
Your Kubernetes master has initialized successfully!
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
http://kubernetes.io/docs/admin/addons/
You can now join any number of machines by running the following on each node:
kubeadm join --token=eb97c5.c75bdb13c260f797 192.168.32.31
Fri Jan 6 08:35:09 EST 2017
##Step 5: taint nodes...
node "host31" tainted
NAME STATUS AGE
host31 Ready,master 48s
Fri Jan 6 08:35:18 EST 2017
##Step 6: confirm version...
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:57:05Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:52:01Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
kubeadm version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.0.2074+a092d8e0f95f52", GitCommit:"a092d8e0f95f5200f7ae2cba45c75ab42da36537", GitTreeState:"clean", BuildDate:"2016-12-13T17:03:18Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Fri Jan 6 08:35:21 EST 2017
##Step 7: set weave-kube ...
daemonset "weave-net" created
No resources found.
[root@host31 tmp]#
[root@host31 tmp]# kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:57:05Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:52:01Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
[root@host31 tmp]# docker version
Client:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.centos.x86_64
Go version: go1.6.3
Git commit: 3999ccb-unsupported
Built: Thu Dec 15 17:24:43 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.centos.x86_64
Go version: go1.6.3
Git commit: 3999ccb-unsupported
Built: Thu Dec 15 17:24:43 2016
OS/Arch: linux/amd64
[root@host31 tmp]#
[root@host31 tmp]# kubectl get nodes
NAME STATUS AGE
host31 Ready,master 4m
[root@host31 tmp]#