Master 日志:
---> Package docker-ce-selinux.noarch 0:17.03.2.ce-1.el7.centos will be installed
--> Finished Dependency Resolution
base/7/x86_64 | 3.6 kB 00:00:00
base/7/x86_64/group_gz | 156 kB 00:00:00
base/7/x86_64/primary_db | 5.7 MB 00:00:01
extras/7/x86_64 | 3.4 kB 00:00:00
extras/7/x86_64/primary_db | 185 kB 00:00:00
updates/7/x86_64 | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 6.9 MB 00:00:02
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
docker-ce-selinux noarch 17.03.2.ce-1.el7.centos /docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch 43 k
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total size: 43 k
Installed size: 43 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch 1/1
setsebool: SELinux is disabled.
Re-declaration of type docker_t
Failed to create node
Bad type declaration at /etc/selinux/targeted/tmp/modules/400/docker/cil:1
/usr/sbin/semodule: Failed!
Verifying : docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch 1/1
Installed:
docker-ce-selinux.noarch 0:17.03.2.ce-1.el7.centos
Complete!
[root@m01 software]# yum localinstall -y /software/docker/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining /software/docker/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm: docker-ce-17.03.2.ce-1.el7.centos.x86_64
Marking /software/docker/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:17.03.2.ce-1.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
docker-ce x86_64 17.03.2.ce-1.el7.centos /docker-ce-17.03.2.ce-1.el7.centos.x86_64 65 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total size: 65 M
Installed size: 65 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-ce-17.03.2.ce-1.el7.centos.x86_64 1/1
Verifying : docker-ce-17.03.2.ce-1.el7.centos.x86_64 1/1
Installed:
docker-ce.x86_64 0:17.03.2.ce-1.el7.centos
Complete!
[root@m01 software]# systemctl enable docker && systemctl start docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@m01 software]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.226.131 m01
[root@m01 software]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.226.131 m01
192.168.226.132 m02
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/hosts" 5L, 199C written
[root@m01 software]# cd k8s/
[root@m01 k8s]# ls
331270b6ba931a571640b0552d8737631cf30cc9cde14eaa45a5acd2afb8f304-kubectl-1.9.1-0.x86_64.rpm
ccc2b7d8ac99c8ead43087e7bb5cc7fb3fe684bfd78241c8240feb945303c40e-kubeadm-1.9.1-0.x86_64.rpm
cec192f6a1a3a90321f0458d336dd56ccbe78f2a47b33bfd6e8fd78151fa3326-kubelet-1.9.1-0.x86_64.rpm
fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm
socat-1.7.3.2-2.el7.x86_64.rpm
[root@m01 k8s]#
[root@m01 k8s]#
[root@m01 k8s]# yum localinstall -y socat-1.7.3.2-2.el7.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining socat-1.7.3.2-2.el7.x86_64.rpm: socat-1.7.3.2-2.el7.x86_64
Marking socat-1.7.3.2-2.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package socat.x86_64 0:1.7.3.2-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
socat x86_64 1.7.3.2-2.el7 /socat-1.7.3.2-2.el7.x86_64 1.1 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total size: 1.1 M
Installed size: 1.1 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : socat-1.7.3.2-2.el7.x86_64 1/1
Verifying : socat-1.7.3.2-2.el7.x86_64 1/1
Installed:
socat.x86_64 0:1.7.3.2-2.el7
Complete!
[root@m01 k8s]# ls
331270b6ba931a571640b0552d8737631cf30cc9cde14eaa45a5acd2afb8f304-kubectl-1.9.1-0.x86_64.rpm
ccc2b7d8ac99c8ead43087e7bb5cc7fb3fe684bfd78241c8240feb945303c40e-kubeadm-1.9.1-0.x86_64.rpm
cec192f6a1a3a90321f0458d336dd56ccbe78f2a47b33bfd6e8fd78151fa3326-kubelet-1.9.1-0.x86_64.rpm
fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm
socat-1.7.3.2-2.el7.x86_64.rpm
[root@m01 k8s]# yum localinstall -y fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm cec192f6a1a3a90321f0458d336dd56ccbe78f2a47b33bfd6e8fd78151fa3326-kubelet-1.9.1-0.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm: kubernetes-cni-0.6.0-0.x86_64
Marking fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm to be installed
Examining cec192f6a1a3a90321f0458d336dd56ccbe78f2a47b33bfd6e8fd78151fa3326-kubelet-1.9.1-0.x86_64.rpm: kubelet-1.9.1-0.x86_64
Marking cec192f6a1a3a90321f0458d336dd56ccbe78f2a47b33bfd6e8fd78151fa3326-kubelet-1.9.1-0.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubelet.x86_64 0:1.9.1-0 will be installed
---> Package kubernetes-cni.x86_64 0:0.6.0-0 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
kubelet x86_64 1.9.1-0 /cec192f6a1a3a90321f0458d336dd56ccbe78f2a47b33bfd6e8fd78151fa3326-kubelet-1.9.1-0.x86_64 96 M
kubernetes-cni x86_64 0.6.0-0 /fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64 31 M
Transaction Summary
===============================================================================================================================================================================================
Install 2 Packages
Total size: 128 M
Installed size: 128 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : kubernetes-cni-0.6.0-0.x86_64 1/2
Installing : kubelet-1.9.1-0.x86_64 2/2
Verifying : kubelet-1.9.1-0.x86_64 1/2
Verifying : kubernetes-cni-0.6.0-0.x86_64 2/2
Installed:
kubelet.x86_64 0:1.9.1-0 kubernetes-cni.x86_64 0:0.6.0-0
Complete!
[root@m01 k8s]# yum localinstall -y 331270b6ba931a571640b0552d8737631cf30cc9cde14eaa45a5acd2afb8f304-kubectl-1.9.1-0.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining 331270b6ba931a571640b0552d8737631cf30cc9cde14eaa45a5acd2afb8f304-kubectl-1.9.1-0.x86_64.rpm: kubectl-1.9.1-0.x86_64
Marking 331270b6ba931a571640b0552d8737631cf30cc9cde14eaa45a5acd2afb8f304-kubectl-1.9.1-0.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubectl.x86_64 0:1.9.1-0 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
kubectl x86_64 1.9.1-0 /331270b6ba931a571640b0552d8737631cf30cc9cde14eaa45a5acd2afb8f304-kubectl-1.9.1-0.x86_64 46 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total size: 46 M
Installed size: 46 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : kubectl-1.9.1-0.x86_64 1/1
Verifying : kubectl-1.9.1-0.x86_64 1/1
Installed:
kubectl.x86_64 0:1.9.1-0
Complete!
[root@m01 k8s]# yum localinstall -y ccc2b7d8ac99c8ead43087e7bb5cc7fb3fe684bfd78241c8240feb945303c40e-kubeadm-1.9.1-0.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining ccc2b7d8ac99c8ead43087e7bb5cc7fb3fe684bfd78241c8240feb945303c40e-kubeadm-1.9.1-0.x86_64.rpm: kubeadm-1.9.1-0.x86_64
Marking ccc2b7d8ac99c8ead43087e7bb5cc7fb3fe684bfd78241c8240feb945303c40e-kubeadm-1.9.1-0.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kubeadm.x86_64 0:1.9.1-0 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
kubeadm x86_64 1.9.1-0 /ccc2b7d8ac99c8ead43087e7bb5cc7fb3fe684bfd78241c8240feb945303c40e-kubeadm-1.9.1-0.x86_64 99 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total size: 99 M
Installed size: 99 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : kubeadm-1.9.1-0.x86_64 1/1
Verifying : kubeadm-1.9.1-0.x86_64 1/1
Installed:
kubeadm.x86_64 0:1.9.1-0
Complete!
[root@m01 k8s]# sed -i 's/cgroup-driver=systemd/cgroup-driver=cgroupfs/g' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
[root@m01 k8s]# systemctl daemon-reload
[root@m01 k8s]# systemctl restart kubelet
[root@m01 k8s]# systemctl enable kubelet && systemctl start kubelet
Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /etc/systemd/system/kubelet.service.
[root@m01 k8s]# systemctl status kubelet
?kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
忖10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Fri 2018-04-06 09:29:35 CST; 5s ago
Docs: http://kubernetes.io/docs/
Process: 2229 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)
Main PID: 2229 (code=exited, status=1/FAILURE)
Apr 06 09:29:35 m01 systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
Apr 06 09:29:35 m01 systemd[1]: Unit kubelet.service entered failed state.
Apr 06 09:29:35 m01 systemd[1]: kubelet.service failed.
[root@m01 k8s]# kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T11:52:23Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[root@m01 k8s]# cat /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local"
Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt"
Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0"
Environment="KUBELET_CGROUP_ARGS=--cgroup-driver=cgroupfs"
Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true --cert-dir=/var/lib/kubelet/pki"
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS
[root@m01 k8s]# cd ..
[root@m01 software]# ls
docker images k8s
[root@m01 software]# cd images/
[root@m01 images]# ls
calicov2.tar k8s-1-9-1.tar kube-flannel.yml
[root@m01 images]# docker load -i k8s-1-9-1.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
0271b8eebde3: Loading layer [==================================================>] 1.338 MB/1.338 MB
d8137b4c1bdc: Loading layer [==================================================>] 209.3 MB/209.3 MB
Loaded image: gcr.io/google_containers/kube-apiserver-amd64:v1.9.1
684c19bf2c27: Loading layer [==================================================>] 44.2 MB/44.2 MB
deb4ca39ea31: Loading layer [==================================================>] 3.358 MB/3.358 MB
d18c8f0b1c08: Loading layer [==================================================>] 63.38 MB/63.38 MB
Loaded image: gcr.io/google_containers/kube-proxy-amd64:v1.9.1
eca5f3d19334: Loading layer [==================================================>] 61.57 MB/61.57 MB
Loaded image: gcr.io/google_containers/kube-scheduler-amd64:v1.9.1
5bef08742407: Loading layer [==================================================>] 4.221 MB/4.221 MB
b87261cc1ccb: Loading layer [==================================================>] 2.56 kB/2.56 kB
ac66a5c581a8: Loading layer [==================================================>] 362 kB/362 kB
22f71f461ac8: Loading layer [==================================================>] 3.072 kB/3.072 kB
686a085da152: Loading layer [==================================================>] 36.63 MB/36.63 MB
Loaded image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.7
6a749002dd6a: Loading layer [==================================================>] 1.338 MB/1.338 MB
bbd07ea14872: Loading layer [==================================================>] 159.2 MB/159.2 MB
611a3394df5d: Loading layer [==================================================>] 32.44 MB/32.44 MB
Loaded image: gcr.io/google_containers/etcd-amd64:3.1.10
073951f756e8: Loading layer [==================================================>] 136.6 MB/136.6 MB
Loaded image: gcr.io/google_containers/kube-controller-manager-amd64:v1.9.1
64c55db70c4a: Loading layer [==================================================>] 121.2 MB/121.2 MB
Loaded image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.8.1
f439636ab0f0: Loading layer [==================================================>] 6.797 MB/6.797 MB
91b6f6ead101: Loading layer [==================================================>] 4.414 MB/4.414 MB
fc3c053505e6: Loading layer [==================================================>] 34.49 MB/34.49 MB
032657ac7c4a: Loading layer [==================================================>] 2.225 MB/2.225 MB
fd713c7c81af: Loading layer [==================================================>] 5.12 kB/5.12 kB
Loaded image: quay.io/coreos/flannel:v0.9.1-amd64
bd94706d2c63: Loading layer [==================================================>] 38.07 MB/38.07 MB
Loaded image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.7
cd69fdcd7591: Loading layer [==================================================>] 46.31 MB/46.31 MB
Loaded image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.7
[root@m01 images]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/google_containers/kube-apiserver-amd64 v1.9.1 e313a3e9d78d 3 months ago 210 MB
gcr.io/google_containers/kube-controller-manager-amd64 v1.9.1 4978f9a64966 3 months ago 138 MB
gcr.io/google_containers/kube-scheduler-amd64 v1.9.1 677911f7ae8f 3 months ago 62.7 MB
gcr.io/google_containers/kube-proxy-amd64 v1.9.1 e470f20528f9 3 months ago 109 MB
gcr.io/google_containers/kubernetes-dashboard-amd64 v1.8.1 e94d2f21bc0c 3 months ago 121 MB
quay.io/coreos/flannel v0.9.1-amd64 2b736d06ca4c 4 months ago 51.3 MB
gcr.io/google_containers/k8s-dns-sidecar-amd64 1.14.7 db76ee297b85 5 months ago 42 MB
gcr.io/google_containers/k8s-dns-kube-dns-amd64 1.14.7 5d049a8c4eec 5 months ago 50.3 MB
gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64 1.14.7 5feec37454f4 5 months ago 40.9 MB
gcr.io/google_containers/etcd-amd64 3.1.10 1406502a6459 7 months ago 193 MB
gcr.io/google_containers/pause-amd64 3.0 99e59f495ffa 23 months ago 747 kB
[root@m01 images]# docker load -i calicov2.tar
6bc5936494e3: Loading layer [==================================================>] 4.232 MB/4.232 MB
8a4976af0856: Loading layer [==================================================>] 49 MB/49 MB
Loaded image: quay.io/calico/kube-controllers:v2.0.0
15f214d79b31: Loading layer [==================================================>] 27.28 MB/27.28 MB
f1788ca18d3e: Loading layer [==================================================>] 2.818 MB/2.818 MB
81000454a064: Loading layer [==================================================>] 3.03 MB/3.03 MB
8384e38ed451: Loading layer [==================================================>] 2.995 MB/2.995 MB
0c9e439eb4e3: Loading layer [==================================================>] 3.474 MB/3.474 MB
103ed6df7544: Loading layer [==================================================>] 26.58 MB/26.58 MB
0d532d232ab8: Loading layer [==================================================>] 8.192 kB/8.192 kB
0696cb302f0c: Loading layer [==================================================>] 2.56 kB/2.56 kB
Loaded image: quay.io/calico/cni:v2.0.0
04a094fe844e: Loading layer [==================================================>] 4.399 MB/4.399 MB
8f949ef08953: Loading layer [==================================================>] 7.39 MB/7.39 MB
9435d79f2519: Loading layer [==================================================>] 248.3 kB/248.3 kB
85f1f95df5aa: Loading layer [==================================================>] 4.794 MB/4.794 MB
13d32c15178b: Loading layer [==================================================>] 255.1 MB/255.1 MB
Loaded image: quay.io/calico/node:v3.0.1
[root@m01 images]# systemctl status kubelet
?kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
忖10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Fri 2018-04-06 09:59:39 CST; 8s ago
Docs: http://kubernetes.io/docs/
Process: 3593 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)
Main PID: 3593 (code=exited, status=1/FAILURE)
Apr 06 09:59:39 m01 systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
Apr 06 09:59:39 m01 systemd[1]: Unit kubelet.service entered failed state.
Apr 06 09:59:39 m01 systemd[1]: kubelet.service failed.
[root@m01 images]# systemctl enable kubelet.service
[root@m01 images]# systemctl status kubelet
?kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
忖10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Fri 2018-04-06 10:01:31 CST; 4s ago
Docs: http://kubernetes.io/docs/
Process: 3723 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)
Main PID: 3723 (code=exited, status=1/FAILURE)
Apr 06 10:01:31 m01 systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
Apr 06 10:01:31 m01 systemd[1]: Unit kubelet.service entered failed state.
Apr 06 10:01:31 m01 systemd[1]: kubelet.service failed.
[root@m01 images]# systemctl start kubelet.service
[root@m01 images]# systemctl status kubelet
?kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
忖10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Fri 2018-04-06 10:02:02 CST; 1s ago
Docs: http://kubernetes.io/docs/
Process: 3749 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)
Main PID: 3749 (code=exited, status=1/FAILURE)
Apr 06 10:02:02 m01 systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
Apr 06 10:02:02 m01 systemd[1]: Unit kubelet.service entered failed state.
Apr 06 10:02:02 m01 systemd[1]: kubelet.service failed.
[root@m01 images]# kubeadm init --kubernetes-version=v1.9.1 --pod-network-cidr=10.244.0.0/16
[init] Using Kubernetes version: v1.9.1
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks.
[WARNING FileExisting-crictl]: crictl not found in system path
[certificates] Generated ca certificate and key.
[certificates] Generated apiserver certificate and key.
[certificates] apiserver serving cert is signed for DNS names [m01 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.1.16]
[certificates] Generated apiserver-kubelet-client certificate and key.
[certificates] Generated sa 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: "admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "scheduler.conf"
[controlplane] Wrote Static Pod manifest for component kube-apiserver to "/etc/kubernetes/manifests/kube-apiserver.yaml"
[controlplane] Wrote Static Pod manifest for component kube-controller-manager to "/etc/kubernetes/manifests/kube-controller-manager.yaml"
[controlplane] Wrote Static Pod manifest for component kube-scheduler to "/etc/kubernetes/manifests/kube-scheduler.yaml"
[etcd] Wrote Static Pod manifest for a local etcd instance to "/etc/kubernetes/manifests/etcd.yaml"
[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests".
[init] This might take a minute or longer if the control plane images have to be pulled.
[apiclient] All control plane components are healthy after 37.507331 seconds
[uploadconfig]聽Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[markmaster] Will mark node m01 as master by adding a label and a taint
[markmaster] Master m01 tainted and labelled with key/value: node-role.kubernetes.io/master=""
[bootstraptoken] Using token: f1eeff.a3a0172faa18e068
[bootstraptoken] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstraptoken] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstraptoken] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstraptoken] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[addons] Applied essential addon: kube-dns
[addons] Applied essential addon: kube-proxy
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following 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:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join --token f1eeff.a3a0172faa18e068 192.168.1.16:6443 --discovery-token-ca-cert-hash sha256:bdd9a822634aaf8aef12ac604ecb151e9ffbb69068571b2098075e08e4445688
[root@m01 images]# export KUBECONFIG=/etc/kubernetes/admin.conf
[root@m01 images]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml
clusterrole "flannel" created
clusterrolebinding "flannel" created
serviceaccount "flannel" created
configmap "kube-flannel-cfg" created
daemonset "kube-flannel-ds" created
[root@m01 images]#
[root@m01 ~]# kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health": "true"}
[root@m01 ~]# kubectl cluster-info
Kubernetes master is running at https://192.168.1.16:6443
KubeDNS is running at https://192.168.1.16:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
[root@m01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
m01 Ready master 2h v1.9.1
m02 NotReady <none> 3m v1.9.1
[root@m01 ~]#