回到老家后手边没有趁手的电脑,只有一个2003年左右的超低配置松下牌笔记本,安装了Ubuntu1604Server版虚拟环境后,在上面试着搭建Kubernetes的单机展示环境,以下是踩坑过程:
安装docker
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get remove docker docker-engine docker-ce docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'docker-engine' is not installed, so not removed
Package 'docker' is not installed, so not removed
Package 'docker.io' is not installed, so not removed
The following packages will be REMOVED:
docker-ce
0 upgraded, 0 newly installed, 1 to remove and 63 not upgraded.
After this operation, 201 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 167732 files and directories currently installed.)
Removing docker-ce (18.06.3~ce~3-0~ubuntu) ...
docker stop/waiting
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...br/>root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads#
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get update
Hit http://security.ubuntu.com trusty-security InRelease
..........................................................................................................
Reading package lists... Done
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get install -y apt-transport-https ca-certificates curl software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version.
ca-certificates is already the newest version.
curl is already the newest version.
software-properties-common is already the newest version.
software-properties-common set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 63 not upgraded.
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
OK
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get update
Ign http://extras.ubuntu.com trusty InRelease
........................................................................................................................
Reading package lists... Done
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get install -y docker-ce
Reading package lists... Done
Building dependency tree
..............................................................................................................................
Processing triggers for ureadahead (0.100.0-16) ...
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# systemctl start docker && systemctl enable docker && systemctl status docker
systemctl: command not foundbr/>root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads#
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get install --reinstall systemd
Reading package lists... Done
Building dependency tree
.................................................................................................................................
Processing triggers for ureadahead (0.100.0-16) ...
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# systemctl start docker && systemctl enable docker
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# docker --version
Docker version 18.06.3-ce, build d7080c1
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.06.3-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: a592beb5bc4c4092b1b1bac971afed27687340c5
init version: fec3683
Security Options:
apparmor
Kernel Version: 4.4.0-142-generic
Operating System: Ubuntu 14.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.842GiB
Name: googlebigtable-virtual-machine
ID: VBLT:KFPE:TNQZ:K5CL:GOAN:DVCD:WPY6:6AY6:YX4C:P55M:QMXO:UJBY
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# docker version
Client:
Version: 18.06.3-ce
API version: 1.38
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:27:13 2019
OS/Arch: linux/amd64
Experimental: false
Server: Engine: Version: 18.06.3-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: d7080c1 Built: Wed Feb 20 02:25:38 2019 OS/Arch: linux/amd64 Experimental: false root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get install bridge-utils Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: bridge-utils 0 upgraded, 1 newly installed, 0 to remove and 58 not upgraded. Need to get 29.2 kB of archives. After this operation, 146 kB of additional disk space will be used. Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/main bridge-utils amd64 1.5-6ubuntu2 [29.2 kB] Fetched 29.2 kB in 3s (9,555 B/s) Selecting previously unselected package bridge-utils. (Reading database ... 168993 files and directories currently installed.) Preparing to unpack .../bridge-utils_1.5-6ubuntu2_amd64.deb ... Unpacking bridge-utils (1.5-6ubuntu2) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Setting up bridge-utils (1.5-6ubuntu2) ... root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# apt-get install openssh-server Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libck-connector0 ncurses-term openssh-sftp-server ssh-import-id Suggested packages: rssh molly-guard monkeysphere The following NEW packages will be installed: libck-connector0 ncurses-term openssh-server openssh-sftp-server ssh-import-id 0 upgraded, 5 newly installed, 0 to remove and 58 not upgraded. Need to get 616 kB of archives. After this operation, 3,420 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libck-connector0 amd64 0.4.5-3.1ubuntu2 [10.5 kB] Get:2 http://cn.archive.ubuntu.com/ubuntu/ trusty/main ncurses-term all 5.9+20140118-1ubuntu1 [243 kB] Get:3 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-sftp-server amd64 1:6.6p1-2ubuntu2.13 [34.2 kB] Get:4 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openssh-server amd64 1:6.6p1-2ubuntu2.13 [319 kB] Get:5 http://cn.archive.ubuntu.com/ubuntu/ trusty/main ssh-import-id all 3.21-0ubuntu1 [9,624 B] Get:6 http://cn.archive.ubuntu.com/ubuntu/ trusty/main ssh-import-id all 3.21-0ubuntu1 [9,624 B] Fetched 608 kB in 2min 18s (4,401 B/s) Preconfiguring packages ... Selecting previously unselected package libck-connector0:amd64. (Reading database ... 169019 files and directories currently installed.) Preparing to unpack .../libck-connector0_0.4.5-3.1ubuntu2_amd64.deb ... Unpacking libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... Selecting previously unselected package ncurses-term. Preparing to unpack .../ncurses-term_5.9+20140118-1ubuntu1_all.deb ... Unpacking ncurses-term (5.9+20140118-1ubuntu1) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a6.6p1-2ubuntu2.13_amd64.deb ... Unpacking openssh-sftp-server (1:6.6p1-2ubuntu2.13) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a6.6p1-2ubuntu2.13_amd64.deb ... Unpacking openssh-server (1:6.6p1-2ubuntu2.13) ... Selecting previously unselected package ssh-import-id. Preparing to unpack .../ssh-import-id_3.21-0ubuntu1_all.deb ... Unpacking ssh-import-id (3.21-0ubuntu1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for ufw (0.34~rc-0ubuntu2) ... Setting up libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... Setting up ncurses-term (5.9+20140118-1ubuntu1) ... Setting up openssh-sftp-server (1:6.6p1-2ubuntu2.13) ... Setting up openssh-server (1:6.6p1-2ubuntu2.13) ... Creating SSH2 RSA key; this may take some time ... Creating SSH2 DSA key; this may take some time ... Creating SSH2 ECDSA key; this may take some time ... Creating SSH2 ED25519 key; this may take some time ... ssh start/running, process 16832 Setting up ssh-import-id (3.21-0ubuntu1) ... Processing triggers for libc-bin (2.19-0ubuntu6.14) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for ufw (0.34~rc-0ubuntu2) ... root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 12:45:c3:de:10:df:ac:80:ac:34:bb:49:6c:a6:7c:d7 root@googlebigtable-virtual-machine The key's randomart image is: +--[ RSA 2048]----+ |
o=. | . ooo o | o +..o. o | o + ..... | B . S . | . = o o | o + . E | . . |
---|
+-----------------+br/>root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads#
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# wget https://github.com/kubernetes/kubernetes/archive/v1.4.12.tar.gz
--2020-05-29 19:59:29-- https://github.com/kubernetes/kubernetes/archive/v1.4.12.tar.gz
Resolving github.com (github.com)... 52.74.223.119
Connecting to github.com (github.com)|52.74.223.119|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/kubernetes/kubernetes/tar.gz/v1.4.12 [following]
--2020-05-29 19:59:32-- https://codeload.github.com/kubernetes/kubernetes/tar.gz/v1.4.12
Resolving codeload.github.com (codeload.github.com)... 54.251.140.56
Connecting to codeload.github.com (codeload.github.com)|54.251.140.56|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v1.4.12.tar.gz’
[ <=> ] 7,335,298 13.5KB/s in 6m 42s
2020-05-29 20:06:17 (17.8 KB/s) - ‘v1.4.12.tar.gz’ saved [7335298]
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# ls
v1.4.12.tar.gz vmware-tools-distribbr/>root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads#
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# tar -xzvf v1.4.12.tar.gz
...................................................................................................
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# ls
kubernetes-1.4.12 v1.4.12.tar.gz vmware-tools-distrib
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# mv kubernetes-1.4.12 /usr/local/
root@googlebigtable-virtual-machine:/home/googlebigtable/Downloads# cd /usr/local/
root@googlebigtable-virtual-machine:/usr/local# ls
bin etc games include kubernetes-1.4.12 lib man sbin share src
root@googlebigtable-virtual-machine:/usr/local# ifconfig -a
docker0 Link encap:Ethernet HWaddr 02:42:38:b0:3a:81
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr 00:0c:29:87:3e:ff
inet addr:192.168.207.131 Bcast:192.168.207.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe87:3eff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:61230 errors:0 dropped:0 overruns:0 frame:0
TX packets:26449 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:77624982 (77.6 MB) TX bytes:2305959 (2.3 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:2142 errors:0 dropped:0 overruns:0 frame:0
TX packets:2142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:202686 (202.6 KB) TX bytes:202686 (202.6 KB)
root@googlebigtable-virtual-machine:/usr/local# ls
bin etc games include kubernetes-1.4.12 lib man sbin share src
root@googlebigtable-virtual-machine:/usr/local# cd kubernetes-1.4.12/
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12# ls
api cluster contrib DESIGN.md federation hooks logo OWNERS Vagrantfile
build cmd CONTRIB.md docs Godeps labels.yaml Makefile pkg
CHANGELOG.md code-of-conduct.md CONTRIBUTING.md examples hack LICENSE Makefile.generated_files README.md
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12# cd cluster/
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster# ls
addons common.sh images kube-push.sh local ovirt saltbase ubuntu
aws gce juju kube-up.sh log-dump.sh OWNERS skeleton update-storage-objects.sh
azure get-kube-local.sh kubectl.sh kube-util.sh mesos photon-controller test-e2e.sh vagrant
azure-legacy get-kube.sh kube-down.sh lib openstack-heat rackspace test-network.sh validate-cluster.sh
centos gke kubemark libvirt-coreos options.md README.md test-smoke.sh vsphere
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster# cd ubuntu/
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# ls
config-default.sh deployAddons.sh master minion namespace.yaml util.sh
config-test.sh download-release.sh master-flannel minion-flannel reconfDocker.sh
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# cp config-default.sh{,.original}
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# ls
config-default.sh config-test.sh download-release.sh master-flannel minion-flannel reconfDocker.sh
config-default.sh.original deployAddons.sh master minion namespace.yaml util.sh
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# gedit config-default.sh
(gedit:17616): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(gedit:17616): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# cat -n config-default.sh
1 #!/bin/bash
2
3 # Copyright 2015 The Kubernetes Authors.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 ## Contains configuration values for the Ubuntu cluster
18
19 # Define all your cluster nodes, MASTER node comes first"
20 # And separated with blank space like
21 export nodes=${nodes:-"[email protected] [email protected] [email protected]"}
22
23 # Define all your nodes role: a(master) or i(minion) or ai(both master and minion),
24 # Roles must be the same order with the nodes.
25 roles=${roles:-"ai i i"}
26 # If it practically impossible to set an array as an environment variable
27 # from a script, so assume variable is a string then convert it to an array
28 export roles_array=($roles)
29
30 # Define minion numbers
31 export NUM_NODES=${NUM_NODES:-3}
32 # define the IP range used for service cluster IPs.
33 # according to rfc 1918 ref: https://tools.ietf.org/html/rfc1918 choose a private ip range here.
34 export SERVICE_CLUSTER_IP_RANGE=${SERVICE_CLUSTER_IP_RANGE:-192.168.3.0/24} # formerly PORTAL_NET
35 # define the IP range used for flannel overlay network, should not conflict with above SERVICE_CLUSTER_IP_RANGE
36
37 # The Ubuntu scripting supports two ways of networking: Flannel and
38 # CNI. To use CNI: (1) put a CNI configuration file, whose basename
39 # is the configured network type plus ".conf", somewhere on the driver
40 # machine (the one running kube-up.sh
) and set CNI_PLUGIN_CONF to a
41 # pathname of that file, (2) put one or more executable binaries on
42 # the driver machine and set CNI_PLUGIN_EXES to a space-separated list
43 # of their pathnames, and (3) set CNI_KUBELET_TRIGGER to identify an
44 # appropriate service on which to trigger the start and stop of the
45 # kubelet on non-master machines. For (1) and (2) the pathnames may
46 # be relative, in which case they are relative to kubernetes/cluster.
47 # If either of CNI_PLUGIN_CONF or CNI_PLUGIN_EXES is undefined or has
48 # a zero length value then Flannel will be used instead of CNI.
49
50 export CNI_PLUGIN_CONF CNI_PLUGIN_EXES CNI_KUBELET_TRIGGER
51 CNI_PLUGIN_CONF=${CNI_PLUGIN_CONF:-""}
52 CNI_PLUGIN_EXES=${CNI_PLUGIN_EXES:-""}
53 CNI_KUBELET_TRIGGER=${CNI_KUBELET_TRIGGER:-networking}
54
55 # Flannel networking is used if CNI networking is not. The following
56 # variable defines the CIDR block from which cluster addresses are
57 # drawn.
58 export FLANNEL_NET=${FLANNEL_NET:-172.16.0.0/16}
59
60 # Optionally add other contents to the Flannel configuration JSON
61 # object normally stored in etcd as /coreos.com/network/config. Use
62 # JSON syntax suitable for insertion into a JSON object constructor
63 # after other field name:value pairs. For example:
64 # FLANNEL_OTHER_NET_CONFIG=', "SubnetMin": "172.16.10.0", "SubnetMax": "172.16.90.0"'
65
66 export FLANNEL_OTHER_NET_CONFIG
67 FLANNEL_OTHER_NET_CONFIG=''
68
69 # Admission Controllers to invoke prior to persisting objects in cluster
70 # If we included ResourceQuota, we should keep it at the end of the list to prevent incremeting quota usage prematurely.
71 export ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,SecurityContextDeny,DefaultStorageClass,ResourceQuota
72
73 # Path to the config file or directory of files of kubelet
74 export KUBELET_CONFIG=${KUBELET_CONFIG:-""}
75
76 # A port range to reserve for services with NodePort visibility
77 SERVICE_NODE_PORT_RANGE=${SERVICE_NODE_PORT_RANGE:-"30000-32767"}
78
79 # Optional: Enable node logging.
80 ENABLE_NODE_LOGGING=false
81 LOGGING_DESTINATION=${LOGGING_DESTINATION:-elasticsearch}
82
83 # Optional: When set to true, Elasticsearch and Kibana will be setup as part of the cluster bring up.
84 ENABLE_CLUSTER_LOGGING=false
85 ELASTICSEARCH_LOGGING_REPLICAS=${ELASTICSEARCH_LOGGING_REPLICAS:-1}
86
87 # Optional: When set to true, heapster, Influxdb and Grafana will be setup as part of the cluster bring up.
88 ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-true}"
89
90 # Extra options to set on the Docker command line. This is useful for setting
91 # --insecure-registry for local registries.
92 DOCKER_OPTS=${DOCKER_OPTS:-""}
93
94 # Extra options to set on the kube-proxy command line. This is useful
95 # for selecting the iptables proxy-mode, for example.
96 KUBE_PROXY_EXTRA_OPTS=${KUBE_PROXY_EXTRA_OPTS:-""}
97
98 # Optional: Install cluster DNS.
99 ENABLE_CLUSTER_DNS="${KUBE_ENABLE_CLUSTER_DNS:-true}"
100 # DNS_SERVER_IP must be a IP in SERVICE_CLUSTER_IP_RANGE
101 DNS_SERVER_IP=${DNS_SERVER_IP:-"192.168.3.10"}
102 DNS_DOMAIN=${DNS_DOMAIN:-"cluster.local"}
103 DNS_REPLICAS=${DNS_REPLICAS:-1}
104
105 # Optional: Install Kubernetes UI
106 ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
107
108 # Optional: Enable setting flags for kube-apiserver to turn on behavior in active-dev
109 #RUNTIME_CONFIG=""
110
111 # Optional: Add http or https proxy when download easy-rsa.
112 # Add environment variable separated with blank space like "http_proxy=http://10.x.x.x:8080 https_proxy=https://10.x.x.x:8443"
113 PROXY_SETTING=${PROXY_SETTING:-""}
114
115 # Optional: Allows kublet/kube-api to be run in privileged mode
116 ALLOW_PRIVILEGED=${ALLOW_PRIVILEGED:-"false"}
117
118 DEBUG=${DEBUG:-"false"}
119
120 # Add SSH_OPTS: Add this to config ssh port
121 SSH_OPTS="-oPort=22 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oLogLevel=ERROR"
122
123 #node信息,默认配置文件由三个物理node组成,其中第一个node既是master,也是slave,后两个是slave。也可以选择不填写
124 export nodes=${nodes:-"[email protected] [email protected] [email protected]"}
125 # a表示Master,s表示slave
126 roles=${roles:-"as s s"}
127
128 # slave node个数
129 export NUM_NODES=${NUM_NODES:-3}
130
131 ##根据实际情况修改,其中export nodes是待安装Kubernetes的机器地址和无密码登录的用户。本次只有一个节点,既是Master 又是 slave:
132
133 # 192.168.207.131为本机ip地址
134 export nodes=${nodes:-"[email protected]"}
135 roles=${roles:-"as"}
136 export NUM_NODES=${NUM_NODES:-1}
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# cp download-release.sh{,.original}
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# gedit download-release.sh
.............................................................................................................
67 #if [ -z "$KUBE_VERSION" ]; then
68 # KUBE_VERSION=$(get_latest_version_number | sed 's/^v//')
69 #fi
70 KUBE_VERSION=1.4.12
【禁止下载github上最新发布的Kubernetes版本,直接下载v1.4.12版】
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# ls -F
config-default.sh config-test.sh download-release.sh~ master-flannel/ namespace.yaml
config-default.sh~ deployAddons.sh download-release.sh.original minion/ reconfDocker.sh
config-default.sh.original download-release.sh master/ minion-flannel/ util.sh*
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster/ubuntu# ./download-release.sh
/usr/local/kubernetes-1.4.12/cluster/ubuntu /usr/local/kubernetes-1.4.12/cluster/ubuntu
Prepare flannel 0.5.5 release ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 643 100 643 0 0 709 0 --:--:-- --:--:-- --:--:-- 708
..............................................................................................................................................
root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster# ./kube-up.sh
... Starting cluster using provider: ubuntu
... calling verify-prereqs
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
... calling kube-up
/usr/local/kubernetes-1.4.12/cluster/ubuntu /usr/local/kubernetes-1.4.12/cluster
Prepare flannel 0.5.5 release ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 643 100 643 0 0 692 0 --:--:-- --:--:-- --:--:-- 692
..........................................................................................................................................
Cluster validation successded
Done,listing cluster services:
kubernetes master is running at http://192.168.207.131:8080
To further debug and diagnose cluster problems,use 'kubectl cluster-info dump'.br/>root@googlebigtable-virtual-machine:/usr/local/kubernetes-1.4.12/cluster#
【注意:执行/usr/local/kubernetes-1.4.12/cluster/ubuntu/ download-release.sh成功并下载etcd、flannel、Kubernetes完毕后,将/usr/local/kubernetes-1.4.12/cluster/ubuntu/ download-release.sh清空,因为 /usr/local/kubernetes-1.4.12/cluster/kube-up.sh 会调用/usr/local/kubernetes-1.4.12/cluster/ubuntu/ download-release.sh并执行下载任务】
【在浏览器中输入http://192.168.207.131:8080可发现Kubernetes集群已经启动成功】
孟伯,20200529
交流联系:微信 1807479153 ,QQ 1807479153