openstack(queens)部署Zun服务

Zun是OpenStack中提供容器服务的组件
以下纯安装过程,基于OpenStack queens版本

环境

controller:192.168.152.101
compute:192.168.152.102

创建数据库

controller节点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@controller ~]# mysql -uroot -p000000
Welcome to the MariaDB monitor. Commands end with ; or \\g.
Your MariaDB connection id is 125
Server version: 10.1.20-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE zun;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zun.* to 'zun'@'localhost'
identified by '000000';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zun.* to 'zun'@'%' identified by
'000000';
Query OK, 0 rows affected (0.00 sec)

创建openstack用户、服务、端点

controller节点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack user create --domain default
--password-prompt zun
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 30f17f5a1baf48febb4260d6526267e4 |
| name | zun |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
[root@controller ~]# openstack role add --project service --user zun
admin
[root@controller ~]# openstack service create --name zun --description
"Container Service" container
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Container Service |
| enabled | True |
| id | 8f23b99db9d8456a8a51535903322275 |
| name | zun |
| type | container |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne container
public http://controller:9517/v1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 8a5b474912a340d3993d094e21bcdc51 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8f23b99db9d8456a8a51535903322275 |
| service_name | zun |
| service_type | container |
| url | http://controller:9517/v1 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne container
internal http://controller:9517/v1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 7ecfa6c448fe4a769617b26439e48598 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8f23b99db9d8456a8a51535903322275 |
| service_name | zun |
| service_type | container |
| url | http://controller:9517/v1 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne container
admin http://controller:9517/v1
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | cfba36a4071b4cf187990ccea63b2161 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 8f23b99db9d8456a8a51535903322275 |
| service_name | zun |
| service_type | container |
| url | http://controller:9517/v1 |
+--------------+----------------------------------+

3. 在controller节点上安装zun服务

3.1 创建用户、组

1
2
3
[root@controller ~]# groupadd --system zun
[root@controller ~]# useradd --home-dir "/var/lib/zun" --create-home --system
--shell /bin/false -g zun zun

3.2 创建目录

1
2
[root@controller ~]# mkdir -p /etc/zun
[root@controller ~]# chown zun:zun /etc/zun

3.3 安装zun

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
[root@controller ~]# yum install python-pip -y
[root@controller ~]# cd /var/lib/zun/
[root@controller zun]# git clone -b stable/queens
https://git.openstack.org/openstack/zun.git
Cloning into 'zun'...
remote: Counting objects: 18434, done.
remote: Compressing objects: 100% (10147/10147), done.
remote: Total 18434 (delta 14071), reused 11745 (delta 7946)
Receiving objects: 100% (18434/18434), 2.55 MiB | 194.00 KiB/s, done.
Resolving deltas: 100% (14071/14071), done.
[root@controller zun]# chown -R zun:zun zun
[root@controller zun]# cd zun
[root@controller zun]# pip install -r requirements.txt
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.10 in
/usr/lib64/python2.7/site-packages (from -r requirements.txt (line 5))
Collecting eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2 (from -r
requirements.txt (line 6))
Downloading
https://files.pythonhosted.org/packages/e4/32/88ee8694dd3985d1615287faa47e458d44a6263ffb59cf71ef70b94df6f9/eventlet-0.20.0-py2.py3-none-any.whl
(387kB)
100% |████████████████████████████████| 389kB 246kB/s
Requirement already satisfied (use --upgrade to upgrade):
keystonemiddleware>=4.17.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade):
jsonpatch!=1.20,>=1.16 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): pbr!=2.1.0,>=2.0.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade):
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 in /usr/lib/python2.7/site-packages
(from -r requirements.txt (line 10))
Collecting python-etcd>=0.4.3 (from -r requirements.txt (line 11))
Downloading
https://files.pythonhosted.org/packages/a1/da/616a4d073642da5dd432e5289b7c1cb0963cc5dde23d1ecb8d726821ab41/python-etcd-0.4.5.tar.gz
Requirement already satisfied (use --upgrade to upgrade):
python-glanceclient>=2.8.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 12))
Requirement already satisfied (use --upgrade to upgrade):
python-neutronclient>=6.3.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 13))
Requirement already satisfied (use --upgrade to upgrade):
python-novaclient>=9.1.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 14))
Requirement already satisfied (use --upgrade to upgrade):
python-cinderclient>=3.3.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 15))
Requirement already satisfied (use --upgrade to upgrade): oslo.i18n>=3.15.3 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 16))
Requirement already satisfied (use --upgrade to upgrade): oslo.log>=3.36.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 17))
Requirement already satisfied (use --upgrade to upgrade):
oslo.concurrency>=3.25.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 18))
Requirement already satisfied (use --upgrade to upgrade): oslo.config>=5.1.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 19))
Requirement already satisfied (use --upgrade to upgrade):
oslo.messaging>=5.29.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 20))
Requirement already satisfied (use --upgrade to upgrade):
oslo.middleware>=3.31.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 21))
Requirement already satisfied (use --upgrade to upgrade): oslo.policy>=1.30.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 22))
Requirement already satisfied (use --upgrade to upgrade): oslo.privsep>=1.23.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 23))
Requirement already satisfied (use --upgrade to upgrade):
oslo.serialization!=2.19.1,>=2.18.0 in /usr/lib/python2.7/site-packages (from
-r requirements.txt (line 24))
Requirement already satisfied (use --upgrade to upgrade):
oslo.service!=1.28.1,>=1.24.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade):
oslo.versionedobjects>=1.31.2 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 26))
Requirement already satisfied (use --upgrade to upgrade): oslo.context>=2.19.2
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 27))
Requirement already satisfied (use --upgrade to upgrade): oslo.utils>=3.33.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 28))
Requirement already satisfied (use --upgrade to upgrade): oslo.db>=4.27.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 29))
Requirement already satisfied (use --upgrade to upgrade): os-vif!=1.8.0,>=1.7.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 30))
Requirement already satisfied (use --upgrade to upgrade): os-brick>=2.2.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 31))
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 32))
Requirement already satisfied (use --upgrade to upgrade): WSME>=0.8.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 33))
Requirement already satisfied (use --upgrade to upgrade):
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 in
/usr/lib64/python2.7/site-packages (from -r requirements.txt (line 34))
Requirement already satisfied (use --upgrade to upgrade): stevedore>=1.20.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 35))
Collecting docker>=2.4.2 (from -r requirements.txt (line 36))
Downloading
https://files.pythonhosted.org/packages/f6/8e/597e81a41598afac5c68180d778bc8513bc763c66158875ddb060371b6f9/docker-3.4.0-py2.py3-none-any.whl
(122kB)
100% |████████████████████████████████| 122kB 151kB/s
Requirement already satisfied (use --upgrade to upgrade): netaddr>=0.7.18 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 37))
Requirement already satisfied (use --upgrade to upgrade): neutron-lib>=1.13.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 38))
Requirement already satisfied (use --upgrade to upgrade): websockify>=0.8.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 39))
Collecting websocket-client<=0.40.0,>=0.33.0 (from -r requirements.txt (line
40))
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after
connection broken by
'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection
object at 0x7f2604899c10>: Failed to establish a new connection: [Errno -3]
Temporary failure in name resolution',)': /simple/websocket-client/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after
connection broken by
'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection
object at 0x7f260411ff10>: Failed to establish a new connection: [Errno -3]
Temporary failure in name resolution',)': /simple/websocket-client/
Downloading
https://files.pythonhosted.org/packages/a7/2b/0039154583cb0489c8e18313aa91ccd140ada103289c5c5d31d80fd6d186/websocket_client-0.40.0.tar.gz
(196kB)
100% |████████████████████████████████| 204kB 134kB/s
Collecting enum-compat (from eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2->-r
requirements.txt (line 6))
Downloading
https://files.pythonhosted.org/packages/95/6e/26bdcba28b66126f66cf3e4cd03bcd63f7ae330d29ee68b1f6b623550bfa/enum-compat-0.0.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.3 in
/usr/lib64/python2.7/site-packages (from
eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2->-r requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): jsonpointer>=1.9 in
/usr/lib/python2.7/site-packages (from jsonpatch!=1.20,>=1.16->-r
requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): WebOb>=1.2dev in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): Mako>=0.4.0 in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): WebTest>=1.3.1 in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): logutils>=0.3 in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): singledispatch in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): urllib3>=1.7.1 in
/usr/lib/python2.7/site-packages (from python-etcd>=0.4.3->-r requirements.txt
(line 11))
Collecting dnspython>=1.13.0 (from python-etcd>=0.4.3->-r requirements.txt
(line 11))
Downloading
https://files.pythonhosted.org/packages/a6/72/209e18bdfedfd78c6994e9ec96981624a5ad7738524dd474237268422cb8/dnspython-1.15.0-py2.py3-none-any.whl
(177kB)
100% |████████████████████████████████| 184kB 110kB/s
Requirement already satisfied (use --upgrade to upgrade): monotonic>=0.6 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): PasteDeploy>=1.5.0 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): Routes>=2.3.1 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Collecting Paste>=2.0.2 (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Downloading
https://files.pythonhosted.org/packages/a4/d2/ac41e1b414ff1ed70c81e493bf9da42fbeeb53774ed1557b4729242a18ab/Paste-2.0.3-py2-none-any.whl
(625kB)
100% |████████████████████████████████| 634kB 144kB/s
Requirement already satisfied (use --upgrade to upgrade): Babel!=2.4.0,>=2.3.4
in /usr/lib/python2.7/site-packages (from os-brick>=2.2.0->-r requirements.txt
(line 31))
Requirement already satisfied (use --upgrade to upgrade): requests>=2.14.2 in
/usr/lib/python2.7/site-packages (from os-brick>=2.2.0->-r requirements.txt
(line 31))
Requirement already satisfied (use --upgrade to upgrade):
retrying!=1.3.0,>=1.2.3 in /usr/lib/python2.7/site-packages (from
os-brick>=2.2.0->-r requirements.txt (line 31))
Requirement already satisfied (use --upgrade to upgrade): os-win>=3.0.0 in
/usr/lib/python2.7/site-packages (from os-brick>=2.2.0->-r requirements.txt
(line 31))
Requirement already satisfied (use --upgrade to upgrade): simplegeneric in
/usr/lib/python2.7/site-packages (from WSME>=0.8.0->-r requirements.txt (line
33))
Requirement already satisfied (use --upgrade to upgrade): pytz in
/usr/lib/python2.7/site-packages (from WSME>=0.8.0->-r requirements.txt (line
33))
Collecting docker-pycreds>=0.3.0 (from docker>=2.4.2->-r requirements.txt
(line 36))
Downloading
https://files.pythonhosted.org/packages/ea/bf/7e70aeebc40407fbdb96fa9f79fc8e4722ea889a99378303e3bcc73f4ab5/docker_pycreds-0.3.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade):
backports.ssl-match-hostname>=3.5; python_version < "3.5" in
/usr/lib/python2.7/site-packages (from docker>=2.4.2->-r requirements.txt
(line 36))
Requirement already satisfied (use --upgrade to upgrade): ipaddress>=1.0.16;
python_version < "3.3" in /usr/lib/python2.7/site-packages (from
docker>=2.4.2->-r requirements.txt (line 36))
Requirement already satisfied (use --upgrade to upgrade): enum34 in
/usr/lib/python2.7/site-packages (from
enum-compat->eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2->-r requirements.txt
(line 6))
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe>=0.9.2 in
/usr/lib64/python2.7/site-packages (from
Mako>=0.4.0->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt
(line 10))
Requirement already satisfied (use --upgrade to upgrade): waitress>=0.8.5 in
/usr/lib/python2.7/site-packages (from
WebTest>=1.3.1->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r
requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in
/usr/lib/python2.7/site-packages (from
WebTest>=1.3.1->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r
requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): repoze.lru>=0.3 in
/usr/lib/python2.7/site-packages (from
Routes>=2.3.1->oslo.service!=1.28.1,>=1.24.0->-r requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): setuptools in
/usr/lib/python2.7/site-packages (from
waitress>=0.8.5->WebTest>=1.3.1->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r
requirements.txt (line 10))
Installing collected packages: enum-compat, eventlet, dnspython, python-etcd,
websocket-client, docker-pycreds, docker, Paste
Running setup.py install for enum-compat ... done
Found existing installation: eventlet 0.20.1
Uninstalling eventlet-0.20.1:
Successfully uninstalled eventlet-0.20.1
Running setup.py install for python-etcd ... done
Running setup.py install for websocket-client ... done
Found existing installation: Paste 1.7.5.1
Uninstalling Paste-1.7.5.1:
Successfully uninstalled Paste-1.7.5.1
Successfully installed Paste-2.0.3 dnspython-1.15.0 docker-3.4.0
docker-pycreds-0.3.0 enum-compat-0.0.2 eventlet-0.20.0 python-etcd-0.4.5
websocket-client-0.40.0
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@controller zun]# python setup.py install

3.4 生成示例配置文件

1
2
3
4
[root@controller zun]# su -s /bin/sh -c "oslo-config-generator --config-file
etc/zun/zun-config-generator.conf" zun
[root@controller zun]# su -s /bin/sh -c "cp etc/zun/zun.conf.sample
/etc/zun/zun.conf" zun

3.5 复制api-paste.ini配置文件

1
2
[root@controller zun]# su -s /bin/sh -c "cp etc/zun/api-paste.ini /etc/zun"
zun

3.6 编辑配置文件,在合适位置添加以下内容

vi /etc/zun/zun.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[DEFAULT]
transport_url = rabbit://openstack:000000@controller
[api]
host_ip = 172.24.19.10
port = 9517
[database]
connection = mysql+pymysql://zun:000000@controller/zun
[keystone_auth]
memcached_servers = controller:11211
www_authenticate_uri = http://controller:5000
project_domain_name = default
project_name = service
user_domain_name = default
password = 000000
username = zun
auth_url = http://controller:5000
auth_type = password
auth_version = v3
auth_protocol = http
service_token_roles_required = True
endpoint_type = internalURL
[keystone_authtoken]
memcached_servers = controller:11211
www_authenticate_uri = http://controller:5000
project_domain_name = default
project_name = service
user_domain_name = default
password = 000000
username = zun
auth_url = http://controller:5000
auth_type = password
auth_version = v3
auth_protocol = http
service_token_roles_required = True
endpoint_type = internalURL
[oslo_concurrency]
lock_path = /var/lib/zun/tmp
[oslo_messaging_notifications]
driver = messaging
[websocket_proxy]
wsproxy_host = 172.24.19.10
wsproxy_port = 6784

3.7 填充数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
[root@controller zun]# su -s /bin/sh -c "zun-db-manage upgrade" zun
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> a9a92eebd9a8,
create_table_zun_service
INFO [alembic.runtime.migration] Running upgrade a9a92eebd9a8 -> 9fe371393a24,
create_table_container
INFO [alembic.runtime.migration] Running upgrade 9fe371393a24 -> 5971a6844738,
add container_id column to container
INFO [alembic.runtime.migration] Running upgrade 5971a6844738 -> 93fbb05b77b9,
add memory field to container
INFO [alembic.runtime.migration] Running upgrade 93fbb05b77b9 -> 63a08e32cc43,
add task state to container
INFO [alembic.runtime.migration] Running upgrade 63a08e32cc43 -> 1192ba19a6e9,
Add cpu workdir ports hostname labels to container
INFO [alembic.runtime.migration] Running upgrade 1192ba19a6e9 -> 72c6947c6636,
create_table_image
INFO [alembic.runtime.migration] Running upgrade 72c6947c6636 -> c5565cbaa3de,
Insert status_reason to Container table
INFO [alembic.runtime.migration] Running upgrade c5565cbaa3de -> 43e1088c3389,
add image_pull_policy column
INFO [alembic.runtime.migration] Running upgrade 43e1088c3389 -> 4a0c4f7a4a33,
add meta addresses to container
INFO [alembic.runtime.migration] Running upgrade 4a0c4f7a4a33 -> 531e4a890480,
add host to container
INFO [alembic.runtime.migration] Running upgrade 531e4a890480 -> bbcfa910a8a5,
add_restart_policy_column
INFO [alembic.runtime.migration] Running upgrade bbcfa910a8a5 -> ad43a2179cf2,
add_status_detail
INFO [alembic.runtime.migration] Running upgrade ad43a2179cf2 -> d1ef05fd92c8,
add tty stdin_open
INFO [alembic.runtime.migration] Running upgrade d1ef05fd92c8 -> 5458f8394206,
add image driver field
INFO [alembic.runtime.migration] Running upgrade 5458f8394206 -> 6fd4f7582eb0,
Add resource provider table
INFO [alembic.runtime.migration] Running upgrade 6fd4f7582eb0 -> 7975b7f0f792,
Add resource class table
INFO [alembic.runtime.migration] Running upgrade 7975b7f0f792 -> 09f196622a3f,
create inventory table
INFO [alembic.runtime.migration] Running upgrade 09f196622a3f -> e4d145e195f4,
Create allocation table
INFO [alembic.runtime.migration] Running upgrade e4d145e195f4 -> 8192905fd835,
add uuid_to_resource_class
INFO [alembic.runtime.migration] Running upgrade 8192905fd835 -> eeac0d191f5a,
add compute node table
INFO [alembic.runtime.migration] Running upgrade eeac0d191f5a -> 53a8b515057e,
Add memory info to compute node
INFO [alembic.runtime.migration] Running upgrade 53a8b515057e -> 4bf34495d060,
Add container number info to compute node
INFO [alembic.runtime.migration] Running upgrade 4bf34495d060 -> ce9944b346cb,
combine tty and stdin_open
INFO [alembic.runtime.migration] Running upgrade ce9944b346cb -> 8c3d80e18eb5,
Add container cpus,cpu_used to compute node
INFO [alembic.runtime.migration] Running upgrade 8c3d80e18eb5 -> 04ba87af76bb,
Add container host operating system info
INFO [alembic.runtime.migration] Running upgrade 04ba87af76bb -> 17ab8b533cc8,
Add container hosts label info
INFO [alembic.runtime.migration] Running upgrade 17ab8b533cc8 -> 5359d23b2322,
add websocket_url and websocket_token
INFO [alembic.runtime.migration] Running upgrade 5359d23b2322 -> 174cafda0857,
add security groups
INFO [alembic.runtime.migration] Running upgrade 174cafda0857 -> 648c25faa0be,
add mem used to compute node
INFO [alembic.runtime.migration] Running upgrade 648c25faa0be -> 75315e219cfb,
Add auto_remove to container
INFO [alembic.runtime.migration] Running upgrade 75315e219cfb -> a251f1f61217,
create capsule table
INFO [alembic.runtime.migration] Running upgrade a251f1f61217 -> 945569b3669f,
add runtime column
INFO [alembic.runtime.migration] Running upgrade 945569b3669f -> 10d65e285a59,
create volume_mapping table
INFO [alembic.runtime.migration] Running upgrade 10d65e285a59 -> 37bce72463e3,
add pci device
INFO [alembic.runtime.migration] Running upgrade 37bce72463e3 -> bcd6410d645e,
add host to capsule
INFO [alembic.runtime.migration] Running upgrade bcd6410d645e -> fc27c7415d9c,
change the properties of meta_labels
INFO [alembic.runtime.migration] Running upgrade fc27c7415d9c -> ff7b9665d504,
add pci stats to compute node
INFO [alembic.runtime.migration] Running upgrade ff7b9665d504 -> f046346d1d87,
add timestamp to pci device
INFO [alembic.runtime.migration] Running upgrade f046346d1d87 -> d2affd5b4172
INFO [alembic.runtime.migration] Running upgrade d2affd5b4172 -> cf46a28f46bc,
add container_actions table
INFO [alembic.runtime.migration] Running upgrade cf46a28f46bc -> b6bfca998431,
add container_actions_events table
INFO [alembic.runtime.migration] Running upgrade b6bfca998431 -> 8b0082d9e7c1,
drop foreign key of container_actions container_uuid
INFO [alembic.runtime.migration] Running upgrade 8b0082d9e7c1 -> 10c9668a816d,
add volumes info and addresses to capsule
INFO [alembic.runtime.migration] Running upgrade 10c9668a816d -> 71f8b4cf1dbf,
upgrade
INFO [alembic.runtime.migration] Running upgrade 71f8b4cf1dbf -> d9714eadbdc2,
add disk to container
INFO [alembic.runtime.migration] Running upgrade d9714eadbdc2 -> 6ff4d35f4334,
change properties of restart policy in capsule
INFO [alembic.runtime.migration] Running upgrade 6ff4d35f4334 -> fb9ad4a050f8,
drop_container_actions_foreign_key
INFO [alembic.runtime.migration] Running upgrade fb9ad4a050f8 -> 50829990c965,
add ondelete to container_actions_events foreign key

3.8 创建启动文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# vi /etc/systemd/system/zun-api.service
[Unit]
Description = OpenStack Container Service API
[Service]
ExecStart = /usr/bin/zun-api
User = zun
[Install]
WantedBy = multi-user.target
# vi **/etc/systemd/system/zun-wsproxy.service**
[Unit]
Description = OpenStack Container Service Websocket Proxy
[Service]
ExecStart = /usr/bin/zun-wsproxy
User = zun
[Install]
WantedBy = multi-user.target

3.9 启动服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
[root@controller zun]# systemctl start zun-api zun-wsproxy
[root@controller zun]# systemctl enable zun-api zun-wsproxy
Created symlink from /etc/systemd/system/multi-user.target.wants/zun-api.service
to /etc/systemd/system/zun-api.service.
Created symlink from
/etc/systemd/system/multi-user.target.wants/zun-wsproxy.service to
/etc/systemd/system/zun-wsproxy.service.
[root@controller zun]# systemctl status zun-api zun-wsproxy
● zun-api.service - OpenStack Container Service API
Loaded: loaded (/etc/systemd/system/zun-api.service; enabled; vendor preset:
disabled)
Active: active (running) since Wed 2018-06-20 07:28:15 EDT; 10s ago
Main PID: 4126 (zun-api)
CGroup: /system.slice/zun-api.service
├─4126 /usr/bin/python /usr/bin/zun-api
├─4148 /usr/bin/python /usr/bin/zun-api
├─4149 /usr/bin/python /usr/bin/zun-api
├─4150 /usr/bin/python /usr/bin/zun-api
├─4151 /usr/bin/python /usr/bin/zun-api
├─4152 /usr/bin/python /usr/bin/zun-api
├─4153 /usr/bin/python /usr/bin/zun-api
├─4154 /usr/bin/python /usr/bin/zun-api
├─4155 /usr/bin/python /usr/bin/zun-api
├─4156 /usr/bin/python /usr/bin/zun-api
├─4157 /usr/bin/python /usr/bin/zun-api
├─4158 /usr/bin/python /usr/bin/zun-api
├─4159 /usr/bin/python /usr/bin/zun-api
├─4160 /usr/bin/python /usr/bin/zun-api
├─4161 /usr/bin/python /usr/bin/zun-api
├─4162 /usr/bin/python /usr/bin/zun-api
└─4163 /usr/bin/python /usr/bin/zun-api
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.336 4154 INFO
eventlet.wsgi.server [-] (4154) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.338 4155 INFO
eventlet.wsgi.server [-] (4155) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.339 4156 INFO
eventlet.wsgi.server [-] (4156) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.340 4157 INFO
eventlet.wsgi.server [-] (4157) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.342 4158 INFO
eventlet.wsgi.server [-] (4158) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.344 4159 INFO
eventlet.wsgi.server [-] (4159) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.345 4160 INFO
eventlet.wsgi.server [-] (4160) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.347 4161 INFO
eventlet.wsgi.server [-] (4161) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.348 4162 INFO
eventlet.wsgi.server [-] (4162) wsgi starting up on http....10:9517
Jun 20 07:28:18 controller zun-api[4126]: 2018-06-20 07:28:18.349 4163 INFO
eventlet.wsgi.server [-] (4163) wsgi starting up on http....10:9517
● zun-wsproxy.service - OpenStack Container Service Websocket Proxy
Loaded: loaded (/etc/systemd/system/zun-wsproxy.service; enabled; vendor preset:
disabled)
Active: active (running) since Wed 2018-06-20 07:28:15 EDT; 10s ago
Main PID: 4127 (zun-wsproxy)
CGroup: /system.slice/zun-wsproxy.service
└─4127 /usr/bin/python /usr/bin/zun-wsproxy
Jun 20 07:28:15 controller systemd[1]: Started OpenStack Container Service
Websocket Proxy.
Jun 20 07:28:15 controller systemd[1]: Starting OpenStack Container Service
Websocket Proxy...
Jun 20 07:28:18 controller zun-wsproxy[4127]: 2018-06-20 07:28:18.298 4127 INFO
zun.cmd.wsproxy [-] start websocket proxy
Jun 20 07:28:18 controller zun-wsproxy[4127]: 2018-06-20 07:28:18.299 4127 INFO
zun.websocket.websocketproxy [-] WebSocket server settings:
Jun 20 07:28:18 controller zun-wsproxy[4127]: 2018-06-20 07:28:18.299 4127 INFO
zun.websocket.websocketproxy [-] - Listen on 172.24...10:6784
Jun 20 07:28:18 controller zun-wsproxy[4127]: 2018-06-20 07:28:18.299 4127 INFO
zun.websocket.websocketproxy [-] - Flash security p... server
Jun 20 07:28:18 controller zun-wsproxy[4127]: 2018-06-20 07:28:18.299 4127 INFO
zun.websocket.websocketproxy [-] - SSL/TLS support
Jun 20 07:28:18 controller zun-wsproxy[4127]: 2018-06-20 07:28:18.300 4127 INFO
zun.websocket.websocketproxy [-] - proxying from 17...ne:None
Hint: Some lines were ellipsized, use -l to show in full..

以下操作在compute节点上执行

4 在compute节点上安装docker-ce

4.1 卸载旧版本的docker

1
[root@compute ~]# yum remove docker docker-common docker-selinux docker-engine -y 

4.2 安装依赖包

1
[root@compute ~]# yum install -y yum-utils device-mapper-persistent-data lvm2

4.3 添加yum阿里源

1
2
3
4
5
[root@compute ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

4.4 更新yum源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@compute ~]# yum makecache fast
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
base | 3.6 kB 00:00:00
centos-ceph-luminous | 2.9 kB 00:00:00
centos-openstack-queens | 2.9 kB 00:00:00
centos-qemu-ev | 2.9 kB 00:00:00
docker-ce-stable | 2.9 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
docker-ce-stable/x86_64/primary_db | 13 kB 00:00:00
Metadata Cache Created

4.5 安装docker-ce

1
[root@compute ~]# yum install docker-ce -y 

4.6 启动docker-ce

1
2
3
4
[root@compute ~]# systemctl start docker
sys[root@compute ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service
to /usr/lib/systemd/system/docker.service.

4.7 添加内核配置参数

1
2
3
4
5
6
7
8
# cat /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
[root@compute ~]# sysctl -p
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1

5 在controller节点上添加kuryr-libnetwork用户

5.1 创建kuryr用户

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@controller ~]# source admin-openrc
[root@controller ~]# openstack user create --domain default --password-prompt
kuryr
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 41dc08dfaec64b8c808fc4dcb4d29bfe |
| name | kuryr |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+

5.2 添加角色

1
[root@controller ~]# openstack role add --project service --user kuryr admin

6 在compute节点安装kuryr-libnetwork

6.1 创建用户

1
2
3
[root@compute ~]# groupadd --system kuryr
[root@compute ~]# useradd --home-dir "/var/lib/kuryr" --create-home --system
--shell /bin/false -g kuryr kuryr

6.2 创建目录

1
2
[root@compute ~]# mkdir -p /etc/kuryr
[root@compute ~]# chown kuryr:kuryr /etc/kuryr

6.3 安装kuryr-libnetwork

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
[root@compute ~]# yum install -y python-pip
[root@compute ~]# cd /var/lib/kuryr
[root@compute ~]# cd /var/lib/kuryr
[root@compute kuryr]# git clone -b stable/queens
https://git.openstack.org/openstack/kuryr-libnetwork.git
Cloning into 'kuryr-libnetwork'...
error: RPC failed; result=6, HTTP code = 0
fatal: The remote end hung up unexpectedly
[root@compute kuryr]# git clone -b stable/queens
https://git.openstack.org/openstack/kuryr-libnetwork.git
Cloning into 'kuryr-libnetwork'...
remote: Counting objects: 4730, done.
remote: Compressing objects: 100% (2175/2175), done.
remote: Total 4730 (delta 3263), reused 3817 (delta 2463)
Receiving objects: 100% (4730/4730), 1.65 MiB | 101.00 KiB/s, done.
Resolving deltas: 100% (3263/3263), done.
[root@compute kuryr]# chown -R kuryr:kuryr kuryr-libnetwork
[root@compute kuryr]# cd kuryr-libnetwork
[root@compute kuryr-libnetwork]# pip install -r requirements.txt
Requirement already satisfied (use --upgrade to upgrade): Babel!=2.4.0,>=2.3.4
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade):
Flask!=0.11,<1.0,>=0.10 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): ipaddress>=1.0.16 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade):
jsonschema<3.0.0,>=2.6.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): kuryr-lib>=0.5.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade): neutron-lib>=1.11.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade):
os-client-config>=1.28.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 11))
Requirement already satisfied (use --upgrade to upgrade):
oslo.concurrency>=3.20.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 12))
Requirement already satisfied (use --upgrade to upgrade): oslo.config>=4.6.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 13))
Requirement already satisfied (use --upgrade to upgrade): oslo.log>=3.30.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 14))
Requirement already satisfied (use --upgrade to upgrade): oslo.utils>=3.31.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 15))
Requirement already satisfied (use --upgrade to upgrade): pbr!=2.1.0,>=2.0.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 16))
Requirement already satisfied (use --upgrade to upgrade):
python-neutronclient>=6.3.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 17))
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 18))
Requirement already satisfied (use --upgrade to upgrade): pytz in
/usr/lib/python2.7/site-packages (from Babel!=2.4.0,>=2.3.4->-r
requirements.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in
/usr/lib/python2.7/site-packages (from Flask!=0.11,<1.0,>=0.10->-r
requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): click>=2.0 in
/usr/lib/python2.7/site-packages (from Flask!=0.11,<1.0,>=0.10->-r
requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in
/usr/lib/python2.7/site-packages (from Flask!=0.11,<1.0,>=0.10->-r
requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in
/usr/lib/python2.7/site-packages (from Flask!=0.11,<1.0,>=0.10->-r
requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): repoze.lru in
/usr/lib/python2.7/site-packages (from jsonschema<3.0.0,>=2.6.0->-r
requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): keystoneauth1>=3.4.0
in /usr/lib/python2.7/site-packages (from kuryr-lib>=0.5.0->-r
requirements.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade): oslo.i18n>=3.15.3 in
/usr/lib/python2.7/site-packages (from kuryr-lib>=0.5.0->-r requirements.txt
(line 9))
Requirement already satisfied (use --upgrade to upgrade): pyroute2>=0.4.21;
sys_platform != "win32" in /usr/lib/python2.7/site-packages (from
kuryr-lib>=0.5.0->-r requirements.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe>=0.23 in
/usr/lib64/python2.7/site-packages (from
Jinja2>=2.4->Flask!=0.11,<1.0,>=0.10->-r requirements.txt (line 6))
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@compute kuryr-libnetwork]# python setup.py install

6.4 生成示例配置文件

1
2
3
4
[root@compute kuryr-libnetwork]# su -s /bin/sh -c
"./tools/generate_config_file_samples.sh" kuryr
[root@compute kuryr-libnetwork]# su -s /bin/sh -c "cp etc/kuryr.conf.sample
/etc/kuryr/kuryr.conf" kuryr

6.5 编辑配置文件,添加以下内容

1
2
3
4
5
6
7
8
9
10
11
12
# vi /etc/kuryr/kuryr.conf
[DEFAULT]
bindir = /usr/libexec/kuryr
[neutron]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:35357
username = kuryr
user_domain_name = default
password = 000000
project_name = service
project_domain_name = default
auth_type = password

6.6 创建启动文件

1
2
3
4
5
6
7
8
# vi /etc/systemd/system/kuryr-libnetwork.service
[Unit]
Description = Kuryr-libnetwork - Docker network plugin for Neutron
[Service]
ExecStart = /usr/bin/kuryr-server --config-file /etc/kuryr/kuryr.conf
CapabilityBoundingSet = CAP_NET_ADMIN
[Install]
WantedBy = multi-user.target

6.7 启动服务

1
2
3
4
5
6
[root@compute kuryr-libnetwork]# systemctl enable kuryr-libnetwork
Created symlink from
/etc/systemd/system/multi-user.target.wants/kuryr-libnetwork.service to
/etc/systemd/system/kuryr-libnetwork.service.
[root@compute kuryr-libnetwork]# systemctl start kuryr-libnetwork
[root@compute kuryr-libnetwork]# systemctl restart docker

6.8 验证

6.8.1 创建kuryr网络

1
2
3
[root@compute kuryr-libnetwork]# docker network create --driver kuryr
--ipam-driver kuryr --subnet 10.10.0.0/16 --gateway=10.10.0.1 test_net
9ab4903d7e7056070da97a667cbb7b2c0801ee25bb9f38fafab6798f087c2dae

6.8.2 查看网络

1
2
3
4
5
6
[root@compute kuryr-libnetwork]# docker network ls
NETWORK ID NAME DRIVER SCOPE
3eadaa82b6d7 bridge bridge local
8c9b9f0285cc host host local
e340dd89e780 none null local
9ab4903d7e70 test_net kuryr local

6.8.3 创建容器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@compute kuryr-libnetwork]# docker run --net test_net cirros ifconfig
Unable to find image 'cirros:latest' locally
latest: Pulling from library/cirros
480d57c7bf4d: Pull complete
0f45bfe9a805: Pull complete
5aa6c26e64dc: Pull complete
Digest: sha256:e67f6f4a0521e326ba2dd697950046aba5ce836edda79cb818d45a56841c7ca2
Status: Downloaded newer image for cirros:latest
eth0 Link encap:Ethernet HWaddr 02:42:9D:F5:4C:8A
inet addr:10.10.0.10 Bcast:10.10.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1450 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1296 (1.2 KiB) TX bytes:648 (648.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

7 在compute节点安装zun服务

7.1 创建用户

1
2
3
[root@compute kuryr-libnetwork]# groupadd --system zun
[root@compute kuryr-libnetwork]# useradd --home-dir "/var/lib/zun"
--create-home --system --shell /bin/false -g zun zun

7.2 创建目录

1
2
[root@compute kuryr-libnetwork]# mkdir -p /etc/zun
[root@compute kuryr-libnetwork]# chown zun:zun /etc/zun

7.3 安装zun

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
[root@compute kuryr-libnetwork]# cd /var/lib/zun
[root@compute zun]# git clone -b stable/queens
https://git.openstack.org/openstack/zun.git
Cloning into 'zun'...
remote: Counting objects: 18434, done.
remote: Compressing objects: 100% (10103/10103), done.
remote: Total 18434 (delta 14071), reused 11790 (delta 7990)
Receiving objects: 100% (18434/18434), 2.56 MiB | 98.00 KiB/s, done.
Resolving deltas: 100% (14071/14071), done.
[root@compute zun]# chown -R zun:zun zun
[root@compute zun]# cd zun
[root@compute zun]# pip install -r requirements.txt
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.10 in
/usr/lib64/python2.7/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade):
eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2 in /usr/lib/python2.7/site-packages
(from -r requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade):
keystonemiddleware>=4.17.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade):
jsonpatch!=1.20,>=1.16 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): pbr!=2.1.0,>=2.0.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade):
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 in /usr/lib/python2.7/site-packages
(from -r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): python-etcd>=0.4.3 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 11))
Requirement already satisfied (use --upgrade to upgrade):
python-glanceclient>=2.8.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 12))
Requirement already satisfied (use --upgrade to upgrade):
python-neutronclient>=6.3.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 13))
Requirement already satisfied (use --upgrade to upgrade):
python-novaclient>=9.1.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 14))
Requirement already satisfied (use --upgrade to upgrade):
python-cinderclient>=3.3.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 15))
Requirement already satisfied (use --upgrade to upgrade): oslo.i18n>=3.15.3 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 16))
Requirement already satisfied (use --upgrade to upgrade): oslo.log>=3.36.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 17))
Requirement already satisfied (use --upgrade to upgrade):
oslo.concurrency>=3.25.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 18))
Requirement already satisfied (use --upgrade to upgrade): oslo.config>=5.1.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 19))
Requirement already satisfied (use --upgrade to upgrade):
oslo.messaging>=5.29.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 20))
Requirement already satisfied (use --upgrade to upgrade):
oslo.middleware>=3.31.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 21))
Requirement already satisfied (use --upgrade to upgrade): oslo.policy>=1.30.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 22))
Requirement already satisfied (use --upgrade to upgrade): oslo.privsep>=1.23.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 23))
Requirement already satisfied (use --upgrade to upgrade):
oslo.serialization!=2.19.1,>=2.18.0 in /usr/lib/python2.7/site-packages (from
-r requirements.txt (line 24))
Requirement already satisfied (use --upgrade to upgrade):
oslo.service!=1.28.1,>=1.24.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade):
oslo.versionedobjects>=1.31.2 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 26))
Requirement already satisfied (use --upgrade to upgrade): oslo.context>=2.19.2
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 27))
Requirement already satisfied (use --upgrade to upgrade): oslo.utils>=3.33.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 28))
Requirement already satisfied (use --upgrade to upgrade): oslo.db>=4.27.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 29))
Requirement already satisfied (use --upgrade to upgrade): os-vif!=1.8.0,>=1.7.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 30))
Requirement already satisfied (use --upgrade to upgrade): os-brick>=2.2.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 31))
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 32))
Requirement already satisfied (use --upgrade to upgrade): WSME>=0.8.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 33))
Requirement already satisfied (use --upgrade to upgrade):
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 in
/usr/lib64/python2.7/site-packages (from -r requirements.txt (line 34))
Requirement already satisfied (use --upgrade to upgrade): stevedore>=1.20.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 35))
Requirement already satisfied (use --upgrade to upgrade): docker>=2.4.2 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 36))
Requirement already satisfied (use --upgrade to upgrade): netaddr>=0.7.18 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 37))
Requirement already satisfied (use --upgrade to upgrade): neutron-lib>=1.13.0
in /usr/lib/python2.7/site-packages (from -r requirements.txt (line 38))
Requirement already satisfied (use --upgrade to upgrade): websockify>=0.8.0 in
/usr/lib/python2.7/site-packages (from -r requirements.txt (line 39))
Requirement already satisfied (use --upgrade to upgrade):
websocket-client<=0.40.0,>=0.33.0 in /usr/lib/python2.7/site-packages (from -r
requirements.txt (line 40))
Requirement already satisfied (use --upgrade to upgrade): enum-compat in
/usr/lib/python2.7/site-packages (from
eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2->-r requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.3 in
/usr/lib64/python2.7/site-packages (from
eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2->-r requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): jsonpointer>=1.9 in
/usr/lib/python2.7/site-packages (from jsonpatch!=1.20,>=1.16->-r
requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): WebOb>=1.2dev in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): Mako>=0.4.0 in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): WebTest>=1.3.1 in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): logutils>=0.3 in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): singledispatch in
/usr/lib/python2.7/site-packages (from
pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): urllib3>=1.7.1 in
/usr/lib/python2.7/site-packages (from python-etcd>=0.4.3->-r requirements.txt
(line 11))
Requirement already satisfied (use --upgrade to upgrade): dnspython>=1.13.0 in
/usr/lib/python2.7/site-packages (from python-etcd>=0.4.3->-r requirements.txt
(line 11))
Requirement already satisfied (use --upgrade to upgrade): monotonic>=0.6 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): PasteDeploy>=1.5.0 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): Routes>=2.3.1 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): Paste>=2.0.2 in
/usr/lib/python2.7/site-packages (from oslo.service!=1.28.1,>=1.24.0->-r
requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): Babel!=2.4.0,>=2.3.4
in /usr/lib/python2.7/site-packages (from os-brick>=2.2.0->-r requirements.txt
(line 31))
Requirement already satisfied (use --upgrade to upgrade): requests>=2.14.2 in
/usr/lib/python2.7/site-packages (from os-brick>=2.2.0->-r requirements.txt
(line 31))
Requirement already satisfied (use --upgrade to upgrade):
retrying!=1.3.0,>=1.2.3 in /usr/lib/python2.7/site-packages (from
os-brick>=2.2.0->-r requirements.txt (line 31))
Requirement already satisfied (use --upgrade to upgrade): os-win>=3.0.0 in
/usr/lib/python2.7/site-packages (from os-brick>=2.2.0->-r requirements.txt
(line 31))
Requirement already satisfied (use --upgrade to upgrade): pytz in
/usr/lib/python2.7/site-packages (from WSME>=0.8.0->-r requirements.txt (line
33))
Requirement already satisfied (use --upgrade to upgrade): simplegeneric in
/usr/lib/python2.7/site-packages (from WSME>=0.8.0->-r requirements.txt (line
33))
Requirement already satisfied (use --upgrade to upgrade): docker-pycreds>=0.3.0
in /usr/lib/python2.7/site-packages (from docker>=2.4.2->-r requirements.txt
(line 36))
Requirement already satisfied (use --upgrade to upgrade):
backports.ssl-match-hostname>=3.5; python_version < "3.5" in
/usr/lib/python2.7/site-packages (from docker>=2.4.2->-r requirements.txt
(line 36))
Requirement already satisfied (use --upgrade to upgrade): ipaddress>=1.0.16;
python_version < "3.3" in /usr/lib/python2.7/site-packages (from
docker>=2.4.2->-r requirements.txt (line 36))
Requirement already satisfied (use --upgrade to upgrade): numpy in
/usr/lib64/python2.7/site-packages (from websockify>=0.8.0->-r
requirements.txt (line 39))
Requirement already satisfied (use --upgrade to upgrade): enum34 in
/usr/lib/python2.7/site-packages (from
enum-compat->eventlet!=0.18.3,!=0.20.1,<0.21.0,>=0.18.2->-r requirements.txt
(line 6))
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe>=0.9.2 in
/usr/lib64/python2.7/site-packages (from
Mako>=0.4.0->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r requirements.txt
(line 10))
Requirement already satisfied (use --upgrade to upgrade): waitress>=0.8.5 in
/usr/lib/python2.7/site-packages (from
WebTest>=1.3.1->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r
requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in
/usr/lib/python2.7/site-packages (from
WebTest>=1.3.1->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r
requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): repoze.lru>=0.3 in
/usr/lib/python2.7/site-packages (from
Routes>=2.3.1->oslo.service!=1.28.1,>=1.24.0->-r requirements.txt (line 25))
Requirement already satisfied (use --upgrade to upgrade): setuptools in
/usr/lib/python2.7/site-packages (from
waitress>=0.8.5->WebTest>=1.3.1->pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0->-r
requirements.txt (line 10))
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@compute zun]# python setup.py install

7.4 生成示例配置文件

1
2
3
4
5
6
# su -s /bin/sh -c "oslo-config-generator --config-file
etc/zun/zun-config-generator.conf" zun
# su -s /bin/sh -c "cp etc/zun/zun.conf.sample /etc/zun/zun.conf" zun
# su -s /bin/sh -c "cp etc/zun/rootwrap.conf /etc/zun/rootwrap.conf" zun
# su -s /bin/sh -c "mkdir -p /etc/zun/rootwrap.d" zun
# su -s /bin/sh -c "cp etc/zun/rootwrap.d/* /etc/zun/rootwrap.d/" zun

7.5 配置zun用户

1
2
# echo "zun ALL=(root) NOPASSWD: /usr/local/bin/zun-rootwrap \\
/etc/zun/rootwrap.conf *" | sudo tee /etc/sudoers.d/zun-rootwrap

7.6 编辑配置文件,添加以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# vi /etc/zun/zun.conf
[DEFAULT]
transport_url = rabbit://openstack:000000@controller
[DEFAULT]
state_path = /var/lib/zun
[database]
connection = mysql+pymysql://zun:000000@controller/zun
[keystone_auth]
memcached_servers = controller:11211
www_authenticate_uri = http://controller:5000
project_domain_name = default
project_name = service
user_domain_name = default
password = 000000
username = zun
auth_url = http://controller:5000
auth_type = password
auth_version = v3
auth_protocol = http
service_token_roles_required = True
endpoint_type = internalURL
[keystone_authtoken]
memcached_servers = controller:11211
www_authenticate_uri= http://controller:5000
project_domain_name = default
project_name = service
user_domain_name = default
password = 000000
username = zun
auth_url = http://controller:5000
auth_type = password
[websocket_proxy]
base_url = ws://controller:6784/
[oslo_concurrency]
lock_path = /var/lib/zun/tmp

7.7 配置docker和kuryr

7.7.1 创建docker配置文件夹

1
[root@compute zun]# mkdir -p /etc/systemd/system/docker.service.d

7.7.2 创建docker配置文件

1
2
3
4
5
# vi /etc/systemd/system/docker.service.d/docker.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --group zun -H tcp://compute:2375 -H
unix:///var/run/docker.sock --cluster-store etcd://controller:2379

7.7.3 重启docker

1
2
[root@compute zun]# systemctl daemon-reload
[root@compute zun]# systemctl restart docker

7.7.4 编辑kuryr配置文件,添加以下内容

1
2
3
# vi /etc/kuryr/kuryr.conf
[DEFAULT]
capability_scope = global

7.7.5 重启kuryr

1
[root@compute zun]# systemctl restart kuryr-libnetwork

7.8 创建启动文件

1
2
3
4
5
6
7
8
# vi /etc/systemd/system/zun-compute.service
[Unit]
Description = OpenStack Container Service Compute Agent
[Service]
ExecStart = /usr/bin/zun-compute
User = zun
[Install]
WantedBy = multi-user.target

7.9 启动zun-compute

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@compute zun]# systemctl start zun-compute
[root@compute zun]# systemctl enable zun-compute
Created symlink from
/etc/systemd/system/multi-user.target.wants/zun-compute.service to
/etc/systemd/system/zun-compute.service.
[root@compute zun]# systemctl status zun-compute
● zun-compute.service - OpenStack Container Service Compute Agent
Loaded: loaded (/etc/systemd/system/zun-compute.service; enabled; vendor preset:
disabled)
Active: active (running) since Wed 2018-06-20 11:06:37 EDT; 13s ago
Main PID: 4923 (zun-compute)
CGroup: /system.slice/zun-compute.service
└─4923 /usr/bin/python /usr/bin/zun-compute
Jun 20 11:06:37 compute systemd[1]: Started OpenStack Container Service Compute
Agent.
Jun 20 11:06:37 compute systemd[1]: Starting OpenStack Container Service Compute
Agent...
Jun 20 11:06:39 compute zun-compute[4923]: 2018-06-20 11:06:39.902 4923 INFO
zun.cmd.compute [-] Starting server in PID 4923
Jun 20 11:06:39 compute zun-compute[4923]: 2018-06-20 11:06:39.913 4923 INFO
zun.container.driver [-] Loading container driver 'docke...Driver'
Jun 20 11:06:40 compute zun-compute[4923]: 2018-06-20 11:06:40.104 4923 INFO
zun.container.driver [-] Loading container driver 'docke...Driver'
Jun 20 11:06:40 compute zun-compute[4923]: 2018-06-20 11:06:40.530 4923 WARNING
zun.compute.compute_node_tracker [-] No compute node ... found.
Jun 20 11:06:40 compute zun-compute[4923]: 2018-06-20 11:06:40.563 4923 INFO
zun.compute.compute_node_tracker [-] Node created for :compute
Hint: Some lines were ellipsized, use -l to show in full.

7.10 验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
controller节点验证
[root@controller ~]# pip install python-zunclient==1.1.0
Collecting python-zunclient==1.1.0
Downloading
https://files.pythonhosted.org/packages/5a/9d/95cd86eaf2c3a721abc28d8d3f1747f789b3e028a8ddf5098da9e69111f8/python_zunclient-1.1.0-py2-none-any.whl
(122kB)
100% |████████████████████████████████| 122kB 86kB/s
Requirement already satisfied (use --upgrade to upgrade):
websocket-client<=0.40.0,>=0.33.0 in /usr/lib/python2.7/site-packages (from
python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): osc-lib>=1.8.0 in
/usr/lib/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.10 in
/usr/lib64/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): oslo.i18n>=3.15.3 in
/usr/lib/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): oslo.utils>=3.33.0 in
/usr/lib/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): docker>=2.4.2 in
/usr/lib/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): keystoneauth1>=3.3.0
in /usr/lib/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade):
python-openstackclient>=3.12.0 in /usr/lib/python2.7/site-packages (from
python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): pbr!=2.1.0,>=2.0.0 in
/usr/lib/python2.7/site-packages (from python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade):
PrettyTable<0.8,>=0.7.1 in /usr/lib/python2.7/site-packages (from
python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): six in
/usr/lib/python2.7/site-packages (from
websocket-client<=0.40.0,>=0.33.0->python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade):
backports.ssl_match_hostname in /usr/lib/python2.7/site-packages (from
websocket-client<=0.40.0,>=0.33.0->python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): docker-pycreds>=0.3.0
in /usr/lib/python2.7/site-packages (from
docker>=2.4.2->python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): ipaddress>=1.0.16;
python_version < "3.3" in /usr/lib/python2.7/site-packages (from
docker>=2.4.2->python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade):
requests!=2.18.0,>=2.14.2 in /usr/lib/python2.7/site-packages (from
docker>=2.4.2->python-zunclient==1.1.0)
Requirement already satisfied (use --upgrade to upgrade): urllib3==1.21.1 in
/usr/lib/python2.7/site-packages (from
requests!=2.18.0,>=2.14.2->docker>=2.4.2->python-zunclient==1.1.0)
Installing collected packages: python-zunclient
Successfully installed python-zunclient-1.1.0
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack appcontainer service list
+----+---------+-------------+-------+----------+-----------------+---------------------------+---------------------------+
| Id | Host | Binary | State | Disabled | Disabled Reason | Created At |
Updated At |
+----+---------+-------------+-------+----------+-----------------+---------------------------+---------------------------+
| 1 | compute | zun-compute | down | False | None | 2018-06-20
15:06:40+00:00 | 2018-06-20 15:08:40+00:00 |
+----+---------+-------------+-------+----------+-----------------+---------------------------+---------------------------+

8 在controller节点启动一个容器实例

8.1 查看网络

1
2
3
4
5
6
7
8
9
10
11
[root@controller ~]# openstack network list
+--------------------------------------+--------------------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+--------------------+--------------------------------------+
| 13c3ecb4-8f1b-46bc-b6dd-b11c0e9b918d | kuryr-net-9ab4903d |
e5c0a1bf-5357-4423-9b7f-8092eff6e3d8 |
| 5cdbccc3-7414-4830-b70d-a798221ee9e4 | provider |
9bb47dec-a69c-4be1-a509-7dd4448aea70 |
| 8e4e0de6-6a55-42cd-b3ab-5f11a02c4ca9 | selfservice |
af931610-c2fc-4db4-9fa2-eab89efbba61 |
+--------------------------------------+--------------------+--------------------------------------+

8.2 获取网络id

1
2
[root@controller ~]# export NET_ID=$(openstack network list | awk '/
selfservice / { print $2 }')

8.3 创建容器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[root@controller ~]# openstack appcontainer run --name container --net
network=$NET_ID cirros
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| addresses | None |
| links | [{u'href':
u'http://controller:9517/v1/containers/145f41f2-dc5f-4b04-9226-6ae248b6061f',
u'rel': u'self'}, {u'href':
u'http://controller:9517/containers/145f41f2-dc5f-4b04-9226-6ae248b6061f',
u'rel': u'bookmark'}] |
| image | cirros |
| labels | {} |
| disk | 0 |
| security_groups | None |
| image_pull_policy | None |
| user_id | a07017719a364efa913cae79bbddbe19 |
| uuid | 145f41f2-dc5f-4b04-9226-6ae248b6061f |
| hostname | None |
| environment | {} |
| memory | None |
| project_id | 14774f73585d4ed48d5198c778645baa |
| status | Error |
| workdir | None |
| auto_remove | False |
| status_detail | None |
| host | None |
| image_driver | None |
| task_state | None |
| status_reason | No valid host was found. Is the appropriate service running?
|
| name | container |
| restart_policy | None |
| ports | None |
| command | None |
| runtime | None |
| cpu | None |
| interactive | False |
+-------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

8.4 查看容器列表

1
# openstack appcontainer list

8.5 执行sh命令

1
# openstack appcontainer exec --interactive container /bin/sh

8.6 验证网络

1
# ping -c 4 openstack.org;exit

8.7 停止容器

1
# openstack appcontainer stop container

8.8 删除容器

1
# openstack appcontainer delete container

9 安装zun-ui

9.1 下载zun源文件

1
# git clone https://github.com/openstack/zun-ui

9.2 复制文件

1
2
3
4
5
6
7
8
9
10
# cp /zun-ui/zun_ui/enabled/_1330_project_container_panelgroup.py
/usr/share/openstack-dashboard/openstack_dashboard/local/enabled/
# cp /zun-ui/zun_ui/enabled/_1331_project_container_containers_panel.py
/usr/share/openstack-dashboard/openstack_dashboard/local/enabled/
# cp./zun-ui/zun_ui/enabled/_2330_project_container_panelgroup.py
/usr/share/openstack-dashboard/openstack_dashboard/local/enabled/
# cp /zun-ui/zun_ui/enabled/_2331_project_container_images_panel.py
openstack_dashboard/local/enabled
# cp /zun-ui/zun_ui/enabled/_0330_cloud_shell.py
/usr/share/openstack-dashboard/openstack_dashboard/local/enabled/

9.3 安装ui模块

1
# pip install zun-ui

9.4 重启服务

1
# systemctl restart httpd memcached