1. 程式人生 > >Easypack 30分鐘安裝kubernetes1 5 1

Easypack 30分鐘安裝kubernetes1 5 1

這裡寫圖片描述

上個月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

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

google_container

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源。

步驟1:git

clone

Master節點和Node節點都需要

git clone https://github.com/liumiaocn/easypack
  • 1

步驟2

Master節點作以下操作

cd easypack/k8s
sh easypack_kubernetes_1.5.1_nowall.sh MASTER
  • 1
  • 2

步驟3:

Node節點作以下操作

git clone https://github.com/liumiaocn/easypack
cd easypack/k8s
sh easypack_kubernetes.sh NODE token MASTERIP
  • 1
  • 2
  • 3

安裝

安裝總時間30分鐘,其中下載google相關映象25分鐘左右。網速慢的只好自求多福吧。

[[email protected] 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.
[[email protected] tmp]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136

結果確認


[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]#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

再分享一下我老師大神的人工智慧教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智慧的隊伍中來!https://www.cnblogs.com/captainbed