k8s-1.7.3 Install Guide

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了k8s-1.7.3 Install Guide相关的知识,希望对你有一定的参考价值。

###############################################
########    k8s-1.7.3 Install Guide   #########
###############################################
###############################################
########    k8s-1.7.3 Install Guide   #########
###############################################

------------------2017-12-16-------------------
Author:Luowei
Date:2017-12-16
mail:[email protected]foxmail.com


#Refer URL:http://www.niuhp.com/docker/create-k8s-cluster-offline.html

1.下载安装所需要的离线包:
链接:https://pan.baidu.com/s/1bzl52Q 密码:dr1q
###############################################
###   k8s-1   master节点   192.168.133.44   ###  
###   k8s-2   node节点     192.168.133.45   ###
###############################################
2.预检查和配置:
#2.1 Linux kernal检查[master和node节点均做]:
[[email protected] ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
[[email protected] ~]# uname -a
Linux k8s-1 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

#2.2.修改hosts文件[master和node节点均做]
vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.133.44 k8s-1
192.168.133.45 k8s-2


#2.3安装docker,docker版本[master和node节点均做]:
yum -y install docker
systemctl enable docker 
systemctl restart docker
systemctl restart network
systemctl status docker
[[email protected] ~]# docker version
Client:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-1.12.6-68.gitec8512b.el7.centos.x86_64
 Go version:      go1.8.3
 Git commit:      ec8512b/1.12.6
 Built:           Mon Dec 11 16:08:42 2017
 OS/Arch:         linux/amd64

Server:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-1.12.6-68.gitec8512b.el7.centos.x86_64
 Go version:      go1.8.3
 Git commit:      ec8512b/1.12.6
 Built:           Mon Dec 11 16:08:42 2017
 OS/Arch:         linux/amd64
[[email protected] ~]#


3.关闭selinux[master和node节点均做]:
vi /etc/selinux/config
SELINUX=disabled
systemctl restart network


4.关闭firewalld,[master和node节点均做]:
systemctl stop firewalld
systemctl disable firewalld
systemctl restart network
systemctl status firewalld

5.编辑并添加如下内容[master和node节点均做]:
[[email protected] ~]#vi /etc/sysctl.conf 
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
systemctl restart network



6.安装[master节点]:
[[email protected] ~]#tar -xzvf k8s-v1.7.3.tar.gz
进入k8s-v1.7.3,运行sh generate.sh生成master文件及node文件目录到output
[[email protected] k8s-v1.7.3]# sh generate.sh 
开始生成master所需文件,请稍等。。。
开始生成node所需文件,请稍等。。。
成功!请将output下master目录及node目录上传到要部署k8s集群的master节点及node节点,然后在node上执行kubeadm join命令加入集群
[[email protected] k8s-v1.7.3]#ls
config  generate.sh  image  kubectl  output  repo  script
[[email protected] k8s-v1.7.3]#cd output
[[email protected] k8s-v1.7.3]#ls
master  node
[[email protected] k8s-v1.7.3]#
进入master目录,运行:
[[email protected] k8s-v1.7.3]#sh init.sh
###一定等到部署ok完node节点以后,用于把node节点加入进来:###
You can now join any number of machines by running the following on each node
as root:

  kubeadm join --token e35778.736fd8c0e78e6e5c 192.168.133.44:6443

#

##############################################
###          master节点详细的流程          ###
##############################################
[[email protected] ~]# cd k8s-v1.7.3/
[[email protected] k8s-v1.7.3]# ll
total 16
drwxr-xr-x 2 root root  140 Aug 11 17:49 config
-rw-r--r-- 1 root root 1745 Aug 11 14:56 generate.sh
drwxr-xr-x 2 root root 4096 Aug 11 11:40 image
drwxr-xr-x 2 root root   20 Aug 11 11:41 kubectl
drwxr-xr-x 2 root root 4096 Aug 11 11:43 repo
drwxr-xr-x 2 root root 4096 Aug 11 16:34 script
[[email protected] k8s-v1.7.3]# sh generate.sh 
开始生成master所需文件,请稍等。。。
开始生成node所需文件,请稍等。。。
成功!请将output下master目录及node目录上传到要部署k8s集群的master节点及node节点,然后在node上执行kubeadm join命令加入集群
[[email protected] k8s-v1.7.3]# cd output/
[[email protected] output]# ll
total 0
drwxr-xr-x 7 root root 83 Dec 16 21:21 master
drwxr-xr-x 6 root root 70 Dec 16 21:21 node
[[email protected] output]# cd master/
[[email protected] master]# ll
total 12
drwxr-xr-x 2 root root  140 Dec 16 21:21 config
drwxr-xr-x 2 root root 4096 Dec 16 21:21 image
-rw-r--r-- 1 root root  146 Dec 16 21:21 init.sh
drwxr-xr-x 2 root root   20 Dec 16 21:21 kubectl
drwxr-xr-x 2 root root 4096 Dec 16 21:21 repo
drwxr-xr-x 2 root root  144 Dec 16 21:21 script
[[email protected] master]# sh init.sh 
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T07:00:21Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
setenforce: SELinux is disabled
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.7.5-0 will be erased
---> Package kubectl.x86_64 0:1.7.5-0 will be erased
---> Package kubelet.x86_64 0:1.7.5-0 will be erased
--> Processing Dependency: kubelet for package: kubernetes-cni-0.5.1-0.x86_64
---> Package socat.x86_64 0:1.7.3.2-2.el7 will be erased
--> Running transaction check
---> Package kubernetes-cni.x86_64 0:0.5.1-0 will be erased
--> Finished Dependency Resolution
base/7/x86_64                                                                                                                                                                              | 3.6 kB  00:00:00     
extras/7/x86_64                                                                                                                                                                            | 3.4 kB  00:00:00     
extras/7/x86_64/primary_db                                                                                                                                                                 | 145 kB  00:00:00     
kubernetes                                                                                                                                                                                 | 1.3 kB  00:00:00     
updates/7/x86_64                                                                                                                                                                           | 3.4 kB  00:00:00     

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                              Arch                                         Version                                                Repository                                         Size
==================================================================================================================================================================================================================
Removing:
 kubeadm                                              x86_64                                       1.7.5-0                                                @kubernetes                                        49 M
 kubectl                                              x86_64                                       1.7.5-0                                                @kubernetes                                        49 M
 kubelet                                              x86_64                                       1.7.5-0                                                @kubernetes                                        96 M
 socat                                                x86_64                                       1.7.3.2-2.el7                                          @base                                             1.1 M
Removing for dependencies:
 kubernetes-cni                                       x86_64                                       0.5.1-0                                                @kubernetes                                        28 M

Transaction Summary
==================================================================================================================================================================================================================
Remove  4 Packages (+1 Dependent package)

Installed size: 223 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : kubeadm-1.7.5-0.x86_64                                                                                                                                                                         1/5 
  Erasing    : kubelet-1.7.5-0.x86_64                                                                                                                                                                         2/5 
  Erasing    : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  3/5 
  Erasing    : kubectl-1.7.5-0.x86_64                                                                                                                                                                         4/5 
  Erasing    : socat-1.7.3.2-2.el7.x86_64                                                                                                                                                                     5/5 
  Verifying  : kubectl-1.7.5-0.x86_64                                                                                                                                                                         1/5 
  Verifying  : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  2/5 
  Verifying  : socat-1.7.3.2-2.el7.x86_64                                                                                                                                                                     3/5 
  Verifying  : kubeadm-1.7.5-0.x86_64                                                                                                                                                                         4/5 
  Verifying  : kubelet-1.7.5-0.x86_64                                                                                                                                                                         5/5 

Removed:
  kubeadm.x86_64 0:1.7.5-0                           kubectl.x86_64 0:1.7.5-0                           kubelet.x86_64 0:1.7.5-0                           socat.x86_64 0:1.7.3.2-2.el7                          

Dependency Removed:
  kubernetes-cni.x86_64 0:0.5.1-0                                                                                                                                                                                 

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/socat-1.7.3.2-1.1.el7.x86_64.rpm: socat-1.7.3.2-1.1.el7.x86_64
Marking ../repo/socat-1.7.3.2-1.1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package socat.x86_64 0:1.7.3.2-1.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                   Arch                                       Version                                             Repository                                                         Size
==================================================================================================================================================================================================================
Installing:
 socat                                     x86_64                                     1.7.3.2-1.1.el7                                     /socat-1.7.3.2-1.1.el7.x86_64                                     1.4 M

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 1.4 M
Installed size: 1.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : socat-1.7.3.2-1.1.el7.x86_64                                                                                                                                                                   1/1 
  Verifying  : socat-1.7.3.2-1.1.el7.x86_64                                                                                                                                                                   1/1 

Installed:
  socat.x86_64 0:1.7.3.2-1.1.el7                                                                                                                                                                                  

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/kubectl-1.7.3-1.x86_64.rpm: kubectl-1.7.3-1.x86_64
Marking ../repo/kubectl-1.7.3-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubectl.x86_64 0:1.7.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                        Arch                                          Version                                        Repository                                                      Size
==================================================================================================================================================================================================================
Installing:
 kubectl                                        x86_64                                        1.7.3-1                                        /kubectl-1.7.3-1.x86_64                                         49 M

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 49 M
Installed size: 49 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kubectl-1.7.3-1.x86_64                                                                                                                                                                         1/1 
  Verifying  : kubectl-1.7.3-1.x86_64                                                                                                                                                                         1/1 

Installed:
  kubectl.x86_64 0:1.7.3-1                                                                                                                                                                                        

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/kubelet-1.7.3-1.x86_64.rpm: kubelet-1.7.3-1.x86_64
Marking ../repo/kubelet-1.7.3-1.x86_64.rpm to be installed
Examining ../repo/kubernetes-cni-0.5.1-0.x86_64.rpm: kubernetes-cni-0.5.1-0.x86_64
Marking ../repo/kubernetes-cni-0.5.1-0.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubelet.x86_64 0:1.7.3-1 will be installed
---> Package kubernetes-cni.x86_64 0:0.5.1-0 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                           Arch                                      Version                                      Repository                                                         Size
==================================================================================================================================================================================================================
Installing:
 kubelet                                           x86_64                                    1.7.3-1                                      /kubelet-1.7.3-1.x86_64                                            96 M
 kubernetes-cni                                    x86_64                                    0.5.1-0                                      /kubernetes-cni-0.5.1-0.x86_64                                     28 M

Transaction Summary
==================================================================================================================================================================================================================
Install  2 Packages

Total size: 124 M
Installed size: 124 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kubelet-1.7.3-1.x86_64                                                                                                                                                                         1/2 
  Installing : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  2/2 
  Verifying  : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  1/2 
  Verifying  : kubelet-1.7.3-1.x86_64                                                                                                                                                                         2/2 

Installed:
  kubelet.x86_64 0:1.7.3-1                                                                             kubernetes-cni.x86_64 0:0.5.1-0                                                                            

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/kubeadm-1.7.3-1.x86_64.rpm: kubeadm-1.7.3-1.x86_64
Marking ../repo/kubeadm-1.7.3-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.7.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                        Arch                                          Version                                        Repository                                                      Size
==================================================================================================================================================================================================================
Installing:
 kubeadm                                        x86_64                                        1.7.3-1                                        /kubeadm-1.7.3-1.x86_64                                         49 M

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 49 M
Installed size: 49 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kubeadm-1.7.3-1.x86_64                                                                                                                                                                         1/1 
  Verifying  : kubeadm-1.7.3-1.x86_64                                                                                                                                                                         1/1 

Installed:
  kubeadm.x86_64 0:1.7.3-1                                                                                                                                                                                        

Complete!
Kubernetes v1.7.3
kubeadm version: &version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T06:43:48Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
start loading image from cni-v1.9.1.tar
4ac76077f2c7: Loading layer [==================================================>] 1.309 MB/1.309 MB
a7cb87a48838: Loading layer [==================================================>] 28.74 MB/28.74 MB
8f94b23aee7f: Loading layer [==================================================>] 2.918 MB/2.918 MB
3955ff59d794: Loading layer [==================================================>] 3.174 MB/3.174 MB
eb4dd7084263: Loading layer [==================================================>]  3.11 MB/3.11 MB
86f88a4f075c: Loading layer [==================================================>] 3.668 MB/3.668 MB
b45bd27da792: Loading layer [==================================================>] 28.12 MB/28.12 MB
53819f87f731: Loading layer [==================================================>]  7.68 kB/7.68 kB
e532460262ad: Loading layer [==================================================>]  2.56 kB/2.56 kB
Loaded image: quay.io/calico/cni:v1.9.1
finish loading image from cni-v1.9.1.tar
start loading image from etcd-2.2.1.tar
d7f400ce6d52: Loading layer [==================================================>] 1.311 MB/1.311 MB
5f70bf18a086: Loading layer [==================================================>] 1.024 kB/1.024 kB
ab3a508cf77a: Loading layer [==================================================>] 14.36 MB/14.36 MB
48221bede375: Loading layer [==================================================>] 12.72 MB/12.72 MB
Loaded image: gcr.io/google_containers/etcd:2.2.1
finish loading image from etcd-2.2.1.tar
start loading image from etcd-amd64-3.0.17.tar
38ac8d0f5bb3: Loading layer [==================================================>] 1.312 MB/1.312 MB
c872b2c2ac77: Loading layer [==================================================>] 136.7 MB/136.7 MB
be71b2a80bbd: Loading layer [==================================================>] 31.16 MB/31.16 MB
Loaded image: gcr.io/google_containers/etcd-amd64:3.0.17
finish loading image from etcd-amd64-3.0.17.tar
start loading image from heapster-amd64-v1.3.0.tar
ea2709de02c6: Loading layer [==================================================>] 67.83 MB/67.83 MB
5d7687e1467b: Loading layer [==================================================>] 281.1 kB/281.1 kB
Loaded image: gcr.io/google_containers/heapster-amd64:v1.3.0
finish loading image from heapster-amd64-v1.3.0.tar
start loading image from heapster-grafana-amd64-v4.4.1.tar
3a1dff9afffd: Loading layer [==================================================>] 1.309 MB/1.309 MB
0b7419f4d518: Loading layer [==================================================>] 147.5 MB/147.5 MB
4356414d9c01: Loading layer [==================================================>] 230.4 kB/230.4 kB
aa0476299350: Loading layer [==================================================>]  2.56 kB/2.56 kB
08d1e7ee379c: Loading layer [==================================================>] 5.606 MB/5.606 MB
Loaded image: gcr.io/google_containers/heapster-grafana-amd64:v4.4.1
finish loading image from heapster-grafana-amd64-v4.4.1.tar
start loading image from heapster-influxdb-amd64-v1.1.1.tar
7da815924651: Loading layer [==================================================>] 10.48 MB/10.48 MB
2d447b9e914f: Loading layer [==================================================>]  5.12 kB/5.12 kB
Loaded image: gcr.io/google_containers/heapster-influxdb-amd64:v1.1.1
finish loading image from heapster-influxdb-amd64-v1.1.1.tar
start loading image from k8s-dns-dnsmasq-nanny-amd64-1.14.4.tar
404361ced64e: Loading layer [==================================================>] 4.221 MB/4.221 MB
27ddb9bf7c7f: Loading layer [==================================================>]  2.56 kB/2.56 kB
d25529a0371e: Loading layer [==================================================>] 353.3 kB/353.3 kB
54203c72264a: Loading layer [==================================================>] 3.072 kB/3.072 kB
780626a0e8a7: Loading layer [==================================================>]  37.1 MB/37.1 MB
Loaded image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
finish loading image from k8s-dns-dnsmasq-nanny-amd64-1.14.4.tar
start loading image from k8s-dns-kube-dns-amd64-1.14.4.tar
8963368d3c63: Loading layer [==================================================>] 45.42 MB/45.42 MB
Loaded image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.4
finish loading image from k8s-dns-kube-dns-amd64-1.14.4.tar
start loading image from k8s-dns-sidecar-amd64-1.14.4.tar
410275e4fd45: Loading layer [==================================================>] 37.86 MB/37.86 MB
Loaded image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.4
finish loading image from k8s-dns-sidecar-amd64-1.14.4.tar
start loading image from kube-apiserver-amd64-v1.7.3.tar
08c2295a7fa5: Loading layer [==================================================>] 1.337 MB/1.337 MB
ec4ce0a87c77: Loading layer [==================================================>]   185 MB/185 MB
Loaded image: gcr.io/google_containers/kube-apiserver-amd64:v1.7.3
finish loading image from kube-apiserver-amd64-v1.7.3.tar
start loading image from kube-controller-manager-amd64-v1.7.3.tar
33d810afef46: Loading layer [==================================================>] 136.8 MB/136.8 MB
Loaded image: gcr.io/google_containers/kube-controller-manager-amd64:v1.7.3
finish loading image from kube-controller-manager-amd64-v1.7.3.tar
start loading image from kube-policy-controller-v0.6.0.tar
ba2cc2690e31: Loading layer [==================================================>] 5.054 MB/5.054 MB
c444d31fcd1a: Loading layer [==================================================>] 40.45 kB/40.45 kB
88b1cd542173: Loading layer [==================================================>] 16.38 kB/16.38 kB
d5f7526f0847: Loading layer [==================================================>]  2.56 kB/2.56 kB
3489efdaec5d: Loading layer [==================================================>] 18.09 MB/18.09 MB
a5081f12b4ac: Loading layer [==================================================>] 1.536 kB/1.536 kB
cfb4fd1f8292: Loading layer [==================================================>] 1.536 kB/1.536 kB
726c64df6a71: Loading layer [==================================================>] 2.048 kB/2.048 kB
Loaded image: quay.io/calico/kube-policy-controller:v0.6.0
finish loading image from kube-policy-controller-v0.6.0.tar
start loading image from kube-proxy-amd64-v1.7.3.tar
d066a55459dd: Loading layer [==================================================>] 42.04 MB/42.04 MB
49f29dc1ad67: Loading layer [==================================================>] 4.744 MB/4.744 MB
8c65f76a6011: Loading layer [==================================================>]  69.7 MB/69.7 MB
Loaded image: gcr.io/google_containers/kube-proxy-amd64:v1.7.3
finish loading image from kube-proxy-amd64-v1.7.3.tar
start loading image from kubernetes-dashboard-amd64-v1.6.3.tar
8fc4262856aa: Loading layer [==================================================>] 139.3 MB/139.3 MB
Loaded image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.6.3
finish loading image from kubernetes-dashboard-amd64-v1.6.3.tar
start loading image from kube-scheduler-amd64-v1.7.3.tar
60d9b2d06402: Loading layer [==================================================>] 76.08 MB/76.08 MB
Loaded image: gcr.io/google_containers/kube-scheduler-amd64:v1.7.3
finish loading image from kube-scheduler-amd64-v1.7.3.tar
start loading image from node-v1.3.0.tar
3fb66f713c9f: Loading layer [==================================================>] 4.221 MB/4.221 MB
e2bbb308de0b: Loading layer [==================================================>] 7.516 MB/7.516 MB
bb58c8e5a444: Loading layer [==================================================>] 249.9 kB/249.9 kB
da5e0c38fd82: Loading layer [==================================================>] 4.681 MB/4.681 MB
f9ffab325a8b: Loading layer [==================================================>] 240.5 MB/240.5 MB
Loaded image: quay.io/calico/node:v1.3.0
finish loading image from node-v1.3.0.tar
start loading image from pause-amd64-3.0.tar
5f70bf18a086: Loading layer [==================================================>] 1.024 kB/1.024 kB
41ff149e94f2: Loading layer [==================================================>] 748.5 kB/748.5 kB
Loaded image: gcr.io/google_containers/pause-amd64:3.0
finish loading image from pause-amd64-3.0.tar
[preflight] Running pre-flight checks
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Removing kubernetes-managed containers
[reset] No etcd manifest found in "/etc/kubernetes/manifests/etcd.yaml", assuming external etcd.
[reset] Deleting contents of stateful directories: [/var/lib/kubelet /etc/cni/net.d /var/lib/dockershim]
[reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[preflight] Starting the kubelet service
[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [k8s-1 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.133.44]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 32.501021 seconds
[token] Using token: e35778.736fd8c0e78e6e5c
[apiconfig] Created RBAC rules
[addons] Applied essential addon: kube-proxy
[addons] Applied essential addon: kube-dns

Your Kubernetes master has initialized successfully!

To start using your cluster, you need to run (as a regular user):

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

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
as root:

  kubeadm join --token e35778.736fd8c0e78e6e5c 192.168.133.44:6443

configmap "calico-config" created
daemonset "calico-etcd" created
service "calico-etcd" created
daemonset "calico-node" created
deployment "calico-policy-controller" created
clusterrolebinding "calico-cni-plugin" created
clusterrole "calico-cni-plugin" created
serviceaccount "calico-cni-plugin" created
clusterrolebinding "calico-policy-controller" created
clusterrole "calico-policy-controller" created
serviceaccount "calico-policy-controller" created
serviceaccount "kubernetes-dashboard" created
clusterrolebinding "kubernetes-dashboard" created
deployment "kubernetes-dashboard" created
service "kubernetes-dashboard" created
clusterrolebinding "heapster" created
deployment "monitoring-influxdb" created
service "monitoring-influxdb" created
serviceaccount "heapster" created
deployment "heapster" created
service "heapster" created
deployment "monitoring-grafana" created
service "monitoring-grafana" created
[[email protected] master]#


##############################################
###            node节点详细的流程          ###
##############################################
[[email protected] k8s-v1.7.3]# sh generate.sh 
开始生成master所需文件,请稍等。。。
开始生成node所需文件,请稍等。。。
成功!请将output下master目录及node目录上传到要部署k8s集群的master节点及node节点,然后在node上执行kubeadm join命令加入集群
[[email protected] k8s-v1.7.3]# cd output/
[[email protected] output]# ll
total 0
drwxr-xr-x 7 root root 83 Dec 16 21:32 master
drwxr-xr-x 6 root root 70 Dec 16 21:32 node
[[email protected] output]# cd node/
[[email protected] node]# ll
total 12
drwxr-xr-x 2 root root 4096 Dec 16 21:32 image
-rw-r--r-- 1 root root  120 Dec 16 21:32 init.sh
drwxr-xr-x 2 root root   20 Dec 16 21:32 kubectl
drwxr-xr-x 2 root root 4096 Dec 16 21:32 repo
drwxr-xr-x 2 root root  116 Dec 16 21:32 script
[[email protected] node]# sh init.sh 
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T07:00:21Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
setenforce: SELinux is disabled
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.7.5-0 will be erased
---> Package kubectl.x86_64 0:1.7.5-0 will be erased
---> Package kubelet.x86_64 0:1.7.5-0 will be erased
--> Processing Dependency: kubelet for package: kubernetes-cni-0.5.1-0.x86_64
---> Package socat.x86_64 0:1.7.3.2-2.el7 will be erased
--> Running transaction check
---> Package kubernetes-cni.x86_64 0:0.5.1-0 will be erased
--> Finished Dependency Resolution
base/7/x86_64                                                                                                                                                                              | 3.6 kB  00:00:00     
extras/7/x86_64                                                                                                                                                                            | 3.4 kB  00:00:00     
extras/7/x86_64/primary_db                                                                                                                                                                 | 145 kB  00:00:00     
kubernetes                                                                                                                                                                                 | 1.3 kB  00:00:00     
updates/7/x86_64                                                                                                                                                                           | 3.4 kB  00:00:00     

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                              Arch                                         Version                                                Repository                                         Size
==================================================================================================================================================================================================================
Removing:
 kubeadm                                              x86_64                                       1.7.5-0                                                @kubernetes                                        49 M
 kubectl                                              x86_64                                       1.7.5-0                                                @kubernetes                                        49 M
 kubelet                                              x86_64                                       1.7.5-0                                                @kubernetes                                        96 M
 socat                                                x86_64                                       1.7.3.2-2.el7                                          @base                                             1.1 M
Removing for dependencies:
 kubernetes-cni                                       x86_64                                       0.5.1-0                                                @kubernetes                                        28 M

Transaction Summary
==================================================================================================================================================================================================================
Remove  4 Packages (+1 Dependent package)

Installed size: 223 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : kubeadm-1.7.5-0.x86_64                                                                                                                                                                         1/5 
  Erasing    : kubelet-1.7.5-0.x86_64                                                                                                                                                                         2/5 
  Erasing    : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  3/5 
  Erasing    : kubectl-1.7.5-0.x86_64                                                                                                                                                                         4/5 
  Erasing    : socat-1.7.3.2-2.el7.x86_64                                                                                                                                                                     5/5 
  Verifying  : kubectl-1.7.5-0.x86_64                                                                                                                                                                         1/5 
  Verifying  : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  2/5 
  Verifying  : socat-1.7.3.2-2.el7.x86_64                                                                                                                                                                     3/5 
  Verifying  : kubeadm-1.7.5-0.x86_64                                                                                                                                                                         4/5 
  Verifying  : kubelet-1.7.5-0.x86_64                                                                                                                                                                         5/5 

Removed:
  kubeadm.x86_64 0:1.7.5-0                           kubectl.x86_64 0:1.7.5-0                           kubelet.x86_64 0:1.7.5-0                           socat.x86_64 0:1.7.3.2-2.el7                          

Dependency Removed:
  kubernetes-cni.x86_64 0:0.5.1-0                                                                                                                                                                                 

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/socat-1.7.3.2-1.1.el7.x86_64.rpm: socat-1.7.3.2-1.1.el7.x86_64
Marking ../repo/socat-1.7.3.2-1.1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package socat.x86_64 0:1.7.3.2-1.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                   Arch                                       Version                                             Repository                                                         Size
==================================================================================================================================================================================================================
Installing:
 socat                                     x86_64                                     1.7.3.2-1.1.el7                                     /socat-1.7.3.2-1.1.el7.x86_64                                     1.4 M

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 1.4 M
Installed size: 1.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : socat-1.7.3.2-1.1.el7.x86_64                                                                                                                                                                   1/1 
  Verifying  : socat-1.7.3.2-1.1.el7.x86_64                                                                                                                                                                   1/1 

Installed:
  socat.x86_64 0:1.7.3.2-1.1.el7                                                                                                                                                                                  

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/kubectl-1.7.3-1.x86_64.rpm: kubectl-1.7.3-1.x86_64
Marking ../repo/kubectl-1.7.3-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubectl.x86_64 0:1.7.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                        Arch                                          Version                                        Repository                                                      Size
==================================================================================================================================================================================================================
Installing:
 kubectl                                        x86_64                                        1.7.3-1                                        /kubectl-1.7.3-1.x86_64                                         49 M

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 49 M
Installed size: 49 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kubectl-1.7.3-1.x86_64                                                                                                                                                                         1/1 
  Verifying  : kubectl-1.7.3-1.x86_64                                                                                                                                                                         1/1 

Installed:
  kubectl.x86_64 0:1.7.3-1                                                                                                                                                                                        

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/kubelet-1.7.3-1.x86_64.rpm: kubelet-1.7.3-1.x86_64
Marking ../repo/kubelet-1.7.3-1.x86_64.rpm to be installed
Examining ../repo/kubernetes-cni-0.5.1-0.x86_64.rpm: kubernetes-cni-0.5.1-0.x86_64
Marking ../repo/kubernetes-cni-0.5.1-0.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubelet.x86_64 0:1.7.3-1 will be installed
---> Package kubernetes-cni.x86_64 0:0.5.1-0 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                           Arch                                      Version                                      Repository                                                         Size
==================================================================================================================================================================================================================
Installing:
 kubelet                                           x86_64                                    1.7.3-1                                      /kubelet-1.7.3-1.x86_64                                            96 M
 kubernetes-cni                                    x86_64                                    0.5.1-0                                      /kubernetes-cni-0.5.1-0.x86_64                                     28 M

Transaction Summary
==================================================================================================================================================================================================================
Install  2 Packages

Total size: 124 M
Installed size: 124 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kubelet-1.7.3-1.x86_64                                                                                                                                                                         1/2 
  Installing : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  2/2 
  Verifying  : kubernetes-cni-0.5.1-0.x86_64                                                                                                                                                                  1/2 
  Verifying  : kubelet-1.7.3-1.x86_64                                                                                                                                                                         2/2 

Installed:
  kubelet.x86_64 0:1.7.3-1                                                                             kubernetes-cni.x86_64 0:0.5.1-0                                                                            

Complete!
Loaded plugins: fastestmirror, langpacks
Examining ../repo/kubeadm-1.7.3-1.x86_64.rpm: kubeadm-1.7.3-1.x86_64
Marking ../repo/kubeadm-1.7.3-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.7.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                        Arch                                          Version                                        Repository                                                      Size
==================================================================================================================================================================================================================
Installing:
 kubeadm                                        x86_64                                        1.7.3-1                                        /kubeadm-1.7.3-1.x86_64                                         49 M

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package

Total size: 49 M
Installed size: 49 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kubeadm-1.7.3-1.x86_64                                                                                                                                                                         1/1 
  Verifying  : kubeadm-1.7.3-1.x86_64                                                                                                                                                                         1/1 

Installed:
  kubeadm.x86_64 0:1.7.3-1                                                                                                                                                                                        

Complete!
Kubernetes v1.7.3
kubeadm version: &version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.3", GitCommit:"2c2fe6e8278a5db2d15a013987b53968c743f2a1", GitTreeState:"clean", BuildDate:"2017-08-03T06:43:48Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
start loading image from cni-v1.9.1.tar
4ac76077f2c7: Loading layer [==================================================>] 1.309 MB/1.309 MB
a7cb87a48838: Loading layer [==================================================>] 28.74 MB/28.74 MB
8f94b23aee7f: Loading layer [==================================================>] 2.918 MB/2.918 MB
3955ff59d794: Loading layer [==================================================>] 3.174 MB/3.174 MB
eb4dd7084263: Loading layer [==================================================>]  3.11 MB/3.11 MB
86f88a4f075c: Loading layer [==================================================>] 3.668 MB/3.668 MB
b45bd27da792: Loading layer [==================================================>] 28.12 MB/28.12 MB
53819f87f731: Loading layer [==================================================>]  7.68 kB/7.68 kB
e532460262ad: Loading layer [==================================================>]  2.56 kB/2.56 kB
Loaded image: quay.io/calico/cni:v1.9.1
finish loading image from cni-v1.9.1.tar
start loading image from heapster-amd64-v1.3.0.tar
ea2709de02c6: Loading layer [==================================================>] 67.83 MB/67.83 MB
5d7687e1467b: Loading layer [==================================================>] 281.1 kB/281.1 kB
Loaded image: gcr.io/google_containers/heapster-amd64:v1.3.0
finish loading image from heapster-amd64-v1.3.0.tar
start loading image from heapster-grafana-amd64-v4.4.1.tar
3a1dff9afffd: Loading layer [==================================================>] 1.309 MB/1.309 MB
0b7419f4d518: Loading layer [==================================================>] 147.5 MB/147.5 MB
4356414d9c01: Loading layer [==================================================>] 230.4 kB/230.4 kB
aa0476299350: Loading layer [==================================================>]  2.56 kB/2.56 kB
08d1e7ee379c: Loading layer [==================================================>] 5.606 MB/5.606 MB
Loaded image: gcr.io/google_containers/heapster-grafana-amd64:v4.4.1
finish loading image from heapster-grafana-amd64-v4.4.1.tar
start loading image from heapster-influxdb-amd64-v1.1.1.tar
38ac8d0f5bb3: Loading layer [==================================================>] 1.312 MB/1.312 MB
7da815924651: Loading layer [==================================================>] 10.48 MB/10.48 MB
2d447b9e914f: Loading layer [==================================================>]  5.12 kB/5.12 kB
Loaded image: gcr.io/google_containers/heapster-influxdb-amd64:v1.1.1
finish loading image from heapster-influxdb-amd64-v1.1.1.tar
start loading image from kube-proxy-amd64-v1.7.3.tar
d066a55459dd: Loading layer [==================================================>] 42.04 MB/42.04 MB
49f29dc1ad67: Loading layer [==================================================>] 4.744 MB/4.744 MB
8c65f76a6011: Loading layer [==================================================>]  69.7 MB/69.7 MB
Loaded image: gcr.io/google_containers/kube-proxy-amd64:v1.7.3
finish loading image from kube-proxy-amd64-v1.7.3.tar
start loading image from kubernetes-dashboard-amd64-v1.6.3.tar
8fc4262856aa: Loading layer [==================================================>] 139.3 MB/139.3 MB
Loaded image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.6.3
finish loading image from kubernetes-dashboard-amd64-v1.6.3.tar
start loading image from node-v1.3.0.tar
3fb66f713c9f: Loading layer [==================================================>] 4.221 MB/4.221 MB
e2bbb308de0b: Loading layer [==================================================>] 7.516 MB/7.516 MB
bb58c8e5a444: Loading layer [==================================================>] 249.9 kB/249.9 kB
da5e0c38fd82: Loading layer [==================================================>] 4.681 MB/4.681 MB
f9ffab325a8b: Loading layer [==================================================>] 240.5 MB/240.5 MB
Loaded image: quay.io/calico/node:v1.3.0
finish loading image from node-v1.3.0.tar
start loading image from pause-amd64-3.0.tar
5f70bf18a086: Loading layer [==================================================>] 1.024 kB/1.024 kB
41ff149e94f2: Loading layer [==================================================>] 748.5 kB/748.5 kB
Loaded image: gcr.io/google_containers/pause-amd64:3.0
finish loading image from pause-amd64-3.0.tar
[preflight] Running pre-flight checks
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Removing kubernetes-managed containers
[reset] No etcd manifest found in "/etc/kubernetes/manifests/etcd.yaml", assuming external etcd.
[reset] Deleting contents of stateful directories: [/var/lib/kubelet /etc/cni/net.d /var/lib/dockershim]
[reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[[email protected] node]#


7.把node节点加入到master中[master节点]:
[[email protected] ~]#kubeadm join --token e35778.736fd8c0e78e6e5c 192.168.133.44:6443
7.1查看node节点状况:
[[email protected] ~]# kubectl get nodes
NAME      STATUS    AGE       VERSION
k8s-1     Ready     2d        v1.7.3
k8s-2     Ready     2d        v1.7.3
[[email protected] ~]#


8.查看状态:
#[[email protected] ~]# kubectl get cs
NAME                 STATUS    MESSAGE              ERROR
scheduler            Healthy   ok                   
controller-manager   Healthy   ok                   
etcd-0               Healthy   {"health": "true"}   
#[[email protected] ~]# kubectl get nodes
NAME      STATUS    AGE       VERSION
k8s-1     Ready     2d        v1.7.3
k8s-2     Ready     2d        v1.7.3
#[[email protected] ~]# kubectl -n kube-system  get pod -o wide 
NAME                                        READY     STATUS    RESTARTS   AGE       IP                NODE
calico-etcd-3z4v2                           1/1       Running   0          2d        192.168.133.44    k8s-1
calico-node-1w09m                           2/2       Running   1          2d        192.168.133.45    k8s-2
calico-node-tpdkm                           2/2       Running   0          2d        192.168.133.44    k8s-1
calico-policy-controller-1727037546-h2gst   1/1       Running   0          2d        192.168.133.44    k8s-1
etcd-k8s-1                                  1/1       Running   0          2d        192.168.133.44    k8s-1
heapster-84017538-l0mv7                     1/1       Running   0          2d        192.168.200.193   k8s-2
kube-apiserver-k8s-1                        1/1       Running   0          2d        192.168.133.44    k8s-1
kube-controller-manager-k8s-1               1/1       Running   0          2d        192.168.133.44    k8s-1
kube-dns-2425271678-rrps9                   3/3       Running   0          2d        192.168.231.194   k8s-1
kube-proxy-cgkds                            1/1       Running   0          2d        192.168.133.44    k8s-1
kube-proxy-wh2rz                            1/1       Running   0          2d        192.168.133.45    k8s-2
kube-scheduler-k8s-1                        1/1       Running   0          2d        192.168.133.44    k8s-1
kubernetes-dashboard-3313488171-9kwpq       1/1       Running   0          2d        192.168.231.193   k8s-1
monitoring-grafana-1500490092-824df         1/1       Running   0          2d        192.168.200.194   k8s-2
monitoring-influxdb-1870447071-65sk6        1/1       Running   0          2d        192.168.200.195   k8s-2
[[email protected] ~]# 
#[[email protected] ~]# kubectl get pods --all-namespaces -o wide
NAMESPACE     NAME                                        READY     STATUS    RESTARTS   AGE       IP                NODE
kube-system   calico-etcd-3z4v2                           1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   calico-node-1w09m                           2/2       Running   1          2d        192.168.133.45    k8s-2
kube-system   calico-node-tpdkm                           2/2       Running   0          2d        192.168.133.44    k8s-1
kube-system   calico-policy-controller-1727037546-h2gst   1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   etcd-k8s-1                                  1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   heapster-84017538-l0mv7                     1/1       Running   0          2d        192.168.200.193   k8s-2
kube-system   kube-apiserver-k8s-1                        1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   kube-controller-manager-k8s-1               1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   kube-dns-2425271678-rrps9                   3/3       Running   0          2d        192.168.231.194   k8s-1
kube-system   kube-proxy-cgkds                            1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   kube-proxy-wh2rz                            1/1       Running   0          2d        192.168.133.45    k8s-2
kube-system   kube-scheduler-k8s-1                        1/1       Running   0          2d        192.168.133.44    k8s-1
kube-system   kubernetes-dashboard-3313488171-9kwpq       1/1       Running   0          2d        192.168.231.193   k8s-1
kube-system   monitoring-grafana-1500490092-824df         1/1       Running   0          2d        192.168.200.194   k8s-2
kube-system   monitoring-influxdb-1870447071-65sk6        1/1       Running   0          2d        192.168.200.195   k8s-2

#[[email protected] ~]# docker ps -a
CONTAINER ID        IMAGE                                      COMMAND                  CREATED             STATUS              PORTS               NAMES
8d41f16db406        38bac66034a6                               "/sidecar --v=2 --log"   2 days ago          Up 2 days                               k8s_sidecar_kube-dns-2425271678-rrps9_kube-system_43f1ffa2-e0b2-11e7-94dd-fa163eadb60c_0
45286680b388        f7f45b9cb733                               "/dnsmasq-nanny -v=2 "   2 days ago          Up 2 days                               k8s_dnsmasq_kube-dns-2425271678-rrps9_kube-system_43f1ffa2-e0b2-11e7-94dd-fa163eadb60c_0
8f521d74e509        a8e00546bcf3                               "/kube-dns --domain=c"   2 days ago          Up 2 days                               k8s_kubedns_kube-dns-2425271678-rrps9_kube-system_43f1ffa2-e0b2-11e7-94dd-fa163eadb60c_0
c466de7b9dfc        b0d769544ab9                               "/dist/controller"       2 days ago          Up 2 days                               k8s_calico-policy-controller_calico-policy-controller-1727037546-h2gst_kube-system_43f3fc31-e0b2-11e7-94dd-fa163eadb60c_0
9ea3a9be406d        691a82db1ecd                               "/dashboard --insecur"   2 days ago          Up 2 days                               k8s_kubernetes-dashboard_kubernetes-dashboard-3313488171-9kwpq_kube-system_43f3aff6-e0b2-11e7-94dd-fa163eadb60c_0
05d359a94c07        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_calico-policy-controller-1727037546-h2gst_kube-system_43f3fc31-e0b2-11e7-94dd-fa163eadb60c_0
702466cf1c91        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_kube-dns-2425271678-rrps9_kube-system_43f1ffa2-e0b2-11e7-94dd-fa163eadb60c_0
444aae45a311        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_kubernetes-dashboard-3313488171-9kwpq_kube-system_43f3aff6-e0b2-11e7-94dd-fa163eadb60c_0
10434fa3c48d        2902c3f3337e                               "/install-cni.sh"        2 days ago          Up 2 days                               k8s_install-cni_calico-node-tpdkm_kube-system_43faa7f0-e0b2-11e7-94dd-fa163eadb60c_0
3674038edc89        ef5842ca5c42                               "/bin/sh -c ‘/usr/loc"   2 days ago          Up 2 days                               k8s_calico-etcd_calico-etcd-3z4v2_kube-system_44905210-e0b2-11e7-94dd-fa163eadb60c_0
2ffb63e5053a        1948433a7679                               "start_runit"            2 days ago          Up 2 days                               k8s_calico-node_calico-node-tpdkm_kube-system_43faa7f0-e0b2-11e7-94dd-fa163eadb60c_0
44a0f4d0f525        54d2a8698e3c                               "/usr/local/bin/kube-"   2 days ago          Up 2 days                               k8s_kube-proxy_kube-proxy-cgkds_kube-system_43f6ea14-e0b2-11e7-94dd-fa163eadb60c_0
a0e01baf937f        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_calico-etcd-3z4v2_kube-system_44905210-e0b2-11e7-94dd-fa163eadb60c_0
58646be237c2        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_calico-node-tpdkm_kube-system_43faa7f0-e0b2-11e7-94dd-fa163eadb60c_0
c71ab333f258        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_kube-proxy-cgkds_kube-system_43f6ea14-e0b2-11e7-94dd-fa163eadb60c_0
5e5f86e5275a        d014f402b272                               "kube-controller-mana"   2 days ago          Up 2 days                               k8s_kube-controller-manager_kube-controller-manager-k8s-1_kube-system_eef47db4e5a6d9f5a630260eace352b8_0
de9016de43cf        a1cc3a3d8d0d                               "kube-apiserver --ins"   2 days ago          Up 2 days                               k8s_kube-apiserver_kube-apiserver-k8s-1_kube-system_154daf7b5dbd32445314ecb31a9df0c0_0
75fc2cd1989d        51967bf607d3                               "kube-scheduler --add"   2 days ago          Up 2 days                               k8s_kube-scheduler_kube-scheduler-k8s-1_kube-system_3386b6e53bb1022a6eaf6f513b40c9e3_0
ba652a5879b7        243830dae7dd                               "etcd --listen-client"   2 days ago          Up 2 days                               k8s_etcd_etcd-k8s-1_kube-system_9ef6d25e21bb4befeabe4d0e4f72d1ca_0
cead0b388650        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_kube-controller-manager-k8s-1_kube-system_eef47db4e5a6d9f5a630260eace352b8_0
cb1b74db6930        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_kube-apiserver-k8s-1_kube-system_154daf7b5dbd32445314ecb31a9df0c0_0
226be191d969        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_etcd-k8s-1_kube-system_9ef6d25e21bb4befeabe4d0e4f72d1ca_0
27469c9be35c        gcr.io/google_containers/pause-amd64:3.0   "/pause"                 2 days ago          Up 2 days                               k8s_POD_kube-scheduler-k8s-1_kube-system_3386b6e53bb1022a6eaf6f513b40c9e3_0
#[[email protected] ~]#
系统信息
机器 ID:c963414522944b13b25855d99aaa7e04
系统 UUID:5CB79E9F-86E5-D344-9341-1799AAB5D6FF
启动 ID:725ee122-6ccb-4194-9d28-c6293c785d0d
内核版本:3.10.0-327.el7.x86_64
操作系统镜像:CentOS Linux 7 (Core)
容器运行时版本:docker://1.12.6
Kubelet 版本:v1.7.3
Kube-Proxy 版本:v1.7.3
操作系统:linux
架构:amd64
#[[email protected] ~]#
系统信息
机器 ID:c963414522944b13b25855d99aaa7e04
系统 UUID:411BFAD0-E5E5-3B42-A72B-3AD3B67AE207
启动 ID:4c6ce913-543f-4da2-a19b-dc484ef8fe81
内核版本:3.10.0-327.el7.x86_64
操作系统镜像:CentOS Linux 7 (Core)
容器运行时版本:docker://1.12.6
Kubelet 版本:v1.7.3
Kube-Proxy 版本:v1.7.3
操作系统:linux
架构:amd64


9.访问k8s-1.7.3的dashboard[Firefox]:
192.168.133.44:31000


10.创建pod验证:
######################################################
###############      创建模板文件    #################
######################################################
#10.1:修改nodeName,修改为node节点的主机名。也就是kubectl get node命令中的node节点的NAME
#[[email protected] ~]# kubectl get nodes
NAME      STATUS    AGE       VERSION
k8s-1     Ready     2d        v1.7.3
k8s-2     Ready     2d        v1.7.3
[[email protected] ~]# less demo.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: demo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo
  template:
    metadata:
      labels:
        app: demo
    spec:
      nodeName: k8s-2
      containers:
      - name: demo
        image: mritd/demo
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
#[[email protected] ~]#
#10.2创建一个pod:
#[[email protected] ~]# kubectl create -f demo.yaml
deployment "demo-deployment" created
#[[email protected] ~]# kubectl get pods
NAME                               READY     STATUS    RESTARTS   AGE
demo-deployment-2163034595-xtrww   1/1       Running   0          3m
#10.3:pod创建ok以后。创建成功后,创建service。其中--external-ip修改为node节点的IP地址
#[[email protected] ~]# kubectl expose deploy demo-deployment --port=80 --type=LoadBalancer --external-ip=192.168.133.45
service "demo-deployment" exposed
#10.4:检查是否成功。
#[[email protected] ~]# kubectl get pod,svc
NAME                                  READY     STATUS    RESTARTS   AGE
po/demo-deployment-2163034595-xtrww   1/1       Running   0          5m

NAME                  CLUSTER-IP      EXTERNAL-IP       PORT(S)        AGE
svc/demo-deployment   10.105.179.81   ,192.168.133.45   80:30263/TCP   15s
svc/kubernetes        10.96.0.1       <none>            443/TCP        2d
#10.5:验证:
#[[email protected] ~]#
在浏览器中访问:external-ip[会返回Your container is running!这样一张图片]

到此已经完全部署ok!!!




######################################################################################
################                     可能查看的CLI                         ###########
######################################################################################
#[[email protected] ~]# kubectl get pods
NAME                               READY     STATUS    RESTARTS   AGE
demo-deployment-2163034595-xtrww   1/1       Running   0          26m
#[[email protected] ~]# kubectl describe all
Name:           demo-deployment-2163034595-xtrww
Namespace:      default
Node:           k8s-2/192.168.133.45
Start Time:     Sat, 16 Dec 2017 22:34:56 +0800
Labels:         app=demo
                pod-template-hash=2163034595
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"demo-deployment-2163034595","uid":"4affafb6-e26e-11e7-94dd-fa163...
Status:         Running
IP:             192.168.200.196
Created By:     ReplicaSet/demo-deployment-2163034595
Controlled By:  ReplicaSet/demo-deployment-2163034595
Containers:
  demo:
    Container ID:       docker://abc119a114ba356cd975e3759ea75a6990d0db01fc0ebd7a420c4b29d5cf4f52
    Image:              mritd/demo
    Image ID:           docker-pullable://docker.io/mritd/[email protected]:a0527fdfe39f57aa384bb28480f4b08dd6be9072f8fad16300283e03efd8adf0
    Port:               80/TCP
    State:              Running
      Started:          Sat, 16 Dec 2017 22:36:03 +0800
    Ready:              True
    Restart Count:      0
    Environment:        <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-8tst3 (ro)
Conditions:
  Type          Status
  Initialized   True 
  Ready         True 
  PodScheduled  True 
Volumes:
  default-token-8tst3:
    Type:       Secret (a volume populated by a Secret)
    SecretName: default-token-8tst3
    Optional:   false
QoS Class:      BestEffort
Node-Selectors: <none>
Tolerations:    node.alpha.kubernetes.io/notReady:NoExecute for 300s
                node.alpha.kubernetes.io/unreachable:NoExecute for 300s
Events:
  FirstSeen     LastSeen        Count   From            SubObjectPath           Type            Reason                  Message
  ---------     --------        -----   ----            -------------           --------        ------                  -------
  27m           27m             1       kubelet, k8s-2                          Normal          SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "default-token-8tst3" 
  27m           27m             1       kubelet, k8s-2  spec.containers{demo}   Normal          Pulling                 pulling image "mritd/demo"
  25m           25m             1       kubelet, k8s-2  spec.containers{demo}   Normal          Pulled                  Successfully pulled image "mritd/demo"
  25m           25m             1       kubelet, k8s-2  spec.containers{demo}   Normal          Created                 Created container
  25m           25m             1       kubelet, k8s-2  spec.containers{demo}   Normal          Started                 Started container


Name:                   demo-deployment
Namespace:              default
Labels:                 app=demo
Annotations:            <none>
Selector:               app=demo
Type:                   LoadBalancer
IP:                     10.105.179.81
External IPs:           192.168.133.45
Port:                   <unset> 80/TCP
NodePort:               <unset> 30263/TCP
Endpoints:              192.168.200.196:80
Session Affinity:       None
Events:                 <none>


Name:                   kubernetes
Namespace:              default
Labels:                 component=apiserver
                        provider=kubernetes
Annotations:            <none>
Selector:               <none>
Type:                   ClusterIP
IP:                     10.96.0.1
Port:                   https   443/TCP
Endpoints:              192.168.133.44:6443
Session Affinity:       ClientIP
Events:                 <none>


Name:                   demo-deployment
Namespace:              default
CreationTimestamp:      Sat, 16 Dec 2017 22:34:59 +0800
Labels:                 app=demo
Annotations:            deployment.kubernetes.io/revision=1
Selector:               app=demo
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  1 max unavailable, 1 max surge
Pod Template:
  Labels:       app=demo
  Containers:
   demo:
    Image:              mritd/demo
    Port:               80/TCP
    Environment:        <none>
    Mounts:             <none>
  Volumes:              <none>
Conditions:
  Type          Status  Reason
  ----          ------  ------
  Available     True    MinimumReplicasAvailable
OldReplicaSets: <none>
NewReplicaSet:  demo-deployment-2163034595 (1/1 replicas created)
Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                    -------------   --------        ------                  -------
  27m           27m             1       deployment-controller                   Normal          ScalingReplicaSet       Scaled up replica set demo-deployment-2163034595 to 1


Name:           demo-deployment-2163034595
Namespace:      default
Selector:       app=demo,pod-template-hash=2163034595
Labels:         app=demo
                pod-template-hash=2163034595
Annotations:    deployment.kubernetes.io/desired-replicas=1
                deployment.kubernetes.io/max-replicas=2
                deployment.kubernetes.io/revision=1
Controlled By:  Deployment/demo-deployment
Replicas:       1 current / 1 desired
Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:       app=demo
                pod-template-hash=2163034595
  Containers:
   demo:
    Image:              mritd/demo
    Port:               80/TCP
    Environment:        <none>
    Mounts:             <none>
  Volumes:              <none>
Events:
  FirstSeen     LastSeen        Count   From                    SubObjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                    -------------   --------        ------                  -------
  27m           27m             1       replicaset-controller                   Normal          SuccessfulCreate        Created pod: demo-deployment-2163034595-xtrww
[[email protected] ~]#

 

以上是关于k8s-1.7.3 Install Guide的主要内容,如果未能解决你的问题,请参考以下文章

guide for install intel opencl

Git Guide

[原]Chef_Server and Chef_WorkStation and Chef_Client Install Guide[by haibo]

GlusterFS分布式存储集群-2. 使用

GlusterFS分布式存储集群-1. 部署

Database 2 Day DBA guide_Chapter2