OpenStack它是一个开源云计算管理平台项目,由几个主要组件组合而成。OpenStack支持几乎所有类型的云环境,项目目标是提供简单、大规模扩展、丰富、统一的云计算管理平台。OpenStack基础设施即服务通过各种互补服务提供(IaaS)每项服务提供的解决方案API集成。常见组件:
虚拟机创建流程:
第一阶段
:
第二阶段
:
第三阶段
:
https://www.cnblogs.com/Studywith/p/17069263.html
本教程使用的是Openstack Queens版本,其他版本也大致与之相同
Openstack版本
OpenStack版本 | 发布时间 | 及其组件 |
---|---|---|
Austin | 2010.10 | Nova、Glance、Keystone、Horizon、Swift、Quantum |
Bexar | 2011.02 | Nova、Glance、Keystone、Horizon、Swift、Quantum |
Cactus | 2011.04 | Nova、Glance、Keystone、Horizon、Swift、Quantum |
Diablo | 2011.09 | Nova、Glance、Keystone、Horizon、Swift、Quantum、Cinder |
Essex | 2012.04 | Nova、Glance、Keystone、Horizon、Swift、Quantum、Cinder、OpenStack Dashboard、Ceilometer |
Folsom | 2012.09 | Nova、Glance、Keystone、Horizon、Swift、Quantum、Cinder、OpenStack Dashboard、Ceilometer |
Grizzly | 2013.04 | Nova、Glance、Keystone、Horizon、Swift、Quantum、Cinder、OpenStack Dashboard、Heat、Ceilometer |
Havana | 2013.10 | Nova、Glance、Keystone、Horizon、Swift、Quantum、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna |
Icehouse | 2014.04 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila |
Juno | 2014.10 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic |
Kilo | 2015.04 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican |
Liberty | 2015.10 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano |
Mitaka | 2016.04 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar |
Newton | 2016.10 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight |
Ocata | 2017.02 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer |
Pike | 2017.08 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari |
Queens |
2018.02 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar |
Rocky | 2018.08 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher |
Stein | 2019.04 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher、Airship |
Train | 2019.10 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher、Airship、Octavia、Karbor |
Ussuri | 2020.05 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher、Airship、Octavia、Karbor、Dragonflow、Vitrage |
Victoria | 2020.10 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher、Airship、Octavia、Karbor、Dragonflow、Vitrage、StarlingX |
Wallaby | 2021.04 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher、Airship、Octavia、Karbor、Dragonflow、Vitrage、StarlingX、Xena |
Yocto | 2021.10 | Nova、Glance、Keystone、Horizon、Swift、Neutron、Cinder、OpenStack Dashboard、Heat、Ceilometer、Trove、Savanna、Manila、Ironic、Designate、Barbican、Magnum、Murano、Zaqar、Congress、Searchlight、Freezer、Masakari、Cyborg、Blazar、Watcher、Airship、Octavia、Karbor、Dragonflow、Vitrage、StarlingX、Xena、Zun |
D | 主机名 | 角色 | 系统信息 | IP | PORT | 组件配置 |
---|---|---|---|---|---|---|
1 | controller | 控制节点 | centos7 | 192.168.71.251 | 8022->22 | MariaDB、身份认证、镜像服务、网络服务、SQL数据库、消息队列 |
2 | compute01 | 计算节点 | centos7 | 192.168.71.252 | 8122->22 | - |
[root@node-251 tmp]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.71.251 node-251
192.168.71.252 node-252
[root@openstack ~]# vim /etc/sysconfig/selinux
SELINUX=disabled
SELINUXTYPE=targeted
[root@openstack ~]# systemctl stop firewalld.service
[root@openstack ~]# systemctl disbale firewalld.service
Chrony与NTP对比
[root@node-251 tmp]# yum install -y chrony
...
[root@node-251 tmp]# systemctl enable chronyd.service
[root@node-251 tmp]# systemctl start chronyd.service
[root@node-251 tmp]# timedatectl set-timezone Asia/Shanghai
[root@node-251 tmp]# date
Mon Jun 5 08:49:57 CST 2023
[root@node-251 tmp]# chronyc sources
210 Number of sources = 4
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^+ ntp8.flashdance.cx 2 6 37 45 +10ms[ +11ms] +/- 103ms
^- time.neu.edu.cn 1 6 17 110 -1169us[+1587us] +/- 1932us
^* stratum2-1.ntp.mow01.ru.> 2 6 253 37 -2841us[-2719us] +/- 57ms
^+ time.cloudflare.com 3 6 37 45 -3414us[-3167us] +/- 93ms
[root@node-251 tmp]# date
Mon Jun 5 08:51:48 CST 2023
[root@node-251 openstack]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
...
2023-06-05 08:54:15 (358 KB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
[root@node-251 openstack]# yum install -y centos-release-openstack-queens.noarch
...
Complete!
[root@node-251 openstack]# yum install -y mariadb mariadb-server MySQL-python
...
也可参考 MySQL
这里密码笔者设置为Admin@123
为了保证数据库服务的安全性,运行mysql_secure_installation
脚本。特别需要说明的是,为数据库的root用户设置一个适当的密码,可以使用openssl rand -hex 10
生成一个10位的密码(笔者这里跳过了)
yum install -y rabbitmq-server
[root@node-251 ~]# systemctl enable rabbitmq-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
[root@node-251 ~]# systemctl start rabbitmq-server.service
[root@node-251 ~]# rabbitmqctl add_user openstack 1735e32955b2ef18362e
Creating user "openstack"
[root@node-251 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/"
[root@node-251 ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
amqp_client
cowlib
cowboy
rabbitmq_web_dispatch
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit@node-251... started 6 plugins.
[root@node-251 ~]# systemctl restart rabbitmq-server.service
访问:http://192.168.71.251:15672
,账号/密码:guest/guest
keystone的主要功能
keystone相关概念
[root@node-251 ~]# openssl rand -hex 10
caf482c375233aa2e42b
[root@openstack ~]# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE keystone;
use mysql;
CREATE USER keystone@'%' IDENTIFIED BY 'caf482c375233aa2e42b';
Grant all privileges on keystone.* to 'keystone'@'%';
flush privileges;
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| keystone | % |
| root | % |
| zsr2 | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
6 rows in set (0.00 sec)
[root@openstack ~]# yum install -y openstack-keystone python-openstackclient httpd mod_wsgi memcached python-memcached
Memcached是一款开源、高性能、分布式内存对象缓存系统,可应用各种需要缓存的场景,其主要目的是通过降低对Database的访问来加速web应用程序。它是一个基于内存的“键值对”存储,用于存储数据库调用、API调用或页面引用结果的直接数据,如字符串、对象等。
Memcached是一款开发工具,它既不是一个代码加速器,也不是数据库中间件。其设计哲学思想主要反映在如下方面:
- 简单key/value存储:服务器不关心数据本身的意义及结构,只要是可序列化数据即可。存储项由“键、过期时间、可选的标志及数据”四个部分组成;
- 功能的实现一半依赖于客户端,一半基于服务器端:客户负责发送存储项至服务器端、从服务端获取数据以及无法连接至服务器时采用相>- 应的动作;服务端负责接收、存储数据,并负责数据项的超时过期;
- 各服务器间彼此无视:不在服务器间进行数据同步;
- O(1)的执行效率;
- 清理超期数据:默认情况下,Memcached是一个LRU缓存,同时,它按事先预订的时长清理超期数据;但事实上,memcached不会删除任何已缓存数据,只是在其过期之后不再为客户所见;而且,memcached也不会真正按期限清理缓存,而仅是当get命令到达时检查其时长。
LRU是Least Recently Used的缩写,即最近最少使用,是一种常用的页面置换算法,选择最近最久未使用的页面予以淘汰
如果出现包兼容问题,例如
Error: Package: python2-qpid-proton-0.22.0-1.el7.x86_64 (centos-openstack-queens)
Requires: qpid-proton-c(x86-64) = 0.22.0-1.el7
Available: qpid-proton-c-0.14.0-2.el7.x86_64 (extras)
qpid-proton-c(x86-64) = 0.14.0-2.el7
Available: qpid-proton-c-0.17.0-4.el7.x86_64 (centos-openstack-queens)
qpid-proton-c(x86-64) = 0.17.0-4.el7
Available: qpid-proton-c-0.22.0-1.el7.x86_64 (centos-openstack-queens)
qpid-proton-c(x86-64) = 0.22.0-1.el7
Installing: qpid-proton-c-0.35.0-1.el7.x86_64 (epel)
qpid-proton-c(x86-64) = 0.35.0-1.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
包冲突导致的兼容错误,单独选定需要的版本进行安装即可
yum install -y python2-qpid-proton-0.22.0-1.el7.x86_64
版本兼容,安装后重新安装报错上一步代码即可
systemctl enable memcached.service
systemctl start memcached.service
[root@node-251 ~]# openssl rand -hex 10
40f04375888cf2554840
[root@node-251 ~]# vim /etc/keystone/keystone.conf
[DEFAULT] #定义初始管理令牌的值
admin_token = 40f04375888cf2554840
[database] #配置数据库访问
connection = mysql+pymysql://keystone:[email protected]/keystone
[revoke] #配置回滚驱动
driver = sql
[token] #配置Fernet UUID令牌的提供者
provider = fernet
[root@node-251 ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone
[root@node-251 ~]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
openstack的各个组件,包括API都是用python写的,但访问的是apache,apache会把请求转发给python去处理,这些包只安装在controler节点
[root@openstack ~]# vim /etc/httpd/conf/httpd.conf
ServerName node-251
[root@openstack ~]# vim /etc/httpd/conf.d/wsgi-keystone.conf
Listen 5000
Listen 35357
<VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /usr/bin/keystone-wsgi-public
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
ErrorLogFormat "%{cu}t %M"
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:35357>
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
ErrorLogFormat "%{cu}t %M"
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
<Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>
systemctl enable httpd.service
systemctl start httpd.service
export OS_TOKEN=40f04375888cf2554840
export OS_URL=http://192.168.71.251:35357/v3
export OS_IDENTITY_API_VERSION=3
域名解析里面加上openstack.if010.com
[root@node-251 ~]# cat /etc/hosts
...
192.168.71.251 openstack.if010.com
[root@node-251 ~]# openstack service create --name keystone --description "OpenStack Identity" identity
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Identity |
| enabled | True |
| id | 922a955e70904b409e0cebff36f5f764 |
| name | keystone |
| type | identity |
+-------------+----------------------------------+
[root@node-251 ~]# openstack endpoint create --region RegionOne identity public http://openstack.if010.com:5000/v3
+--------------+------------------------------------+
| Field | Value |
+--------------+------------------------------------+
| enabled | True |
| id | 5909adff4f7b462686c57c0080825e8e |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 922a955e70904b409e0cebff36f5f764 |
| service_name | keystone |
| service_type | identity |
| url | http://openstack.if010.com:5000/v3 |
+--------------+------------------------------------+
[root@node-251 ~]# openstack endpoint create --region RegionOne identity internal http://openstack.if010.com:5000/v3
+--------------+------------------------------------+
| Field | Value |
+--------------+------------------------------------+
| enabled | True |
| id | 1fdfdd82539c4dbf982c5916b67850ed |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 922a955e70904b409e0cebff36f5f764 |
| service_name | keystone |
| service_type | identity |
| url | http://openstack.if010.com:5000/v3 |
+--------------+------------------------------------+
[root@node-251 ~]# openstack endpoint create --region RegionOne identity admin http://openstack.if010.com:35357/v3
+--------------+-------------------------------------+
| Field | Value |
+--------------+-------------------------------------+
| enabled | True |
| id | 8c60ca51800e444884e031346e2db11b |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 922a955e70904b409e0cebff36f5f764 |
| service_name | keystone |
| service_type | identity |
| url | http://openstack.if010.com:35357/v3 |
+--------------+-------------------------------------+
[root@node-251 ~]# openstack domain create --description "Default Domain" default
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Default Domain |
| enabled | True |
| id | f4e5187c3aef4288b6b2d97c292a69a2 |
| name | default |
| tags | [] |
+-------------+----------------------------------+
[root@node-251 ~]# openstack project create --domain default --description "Admin Project" admin
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Admin Project |
| domain_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled | True |
| id | 2aaf4155b00749b0a333a039c17c131c |
| is_domain | False |
| name | admin |
| parent_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| tags | [] |
+-------------+----------------------------------+
[root@node-251 ~]# openstack user create --domain default --password-prompt admin
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled | True |
| id | 063ef7b979334fa5a86420952a141d32 |
| name | admin |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
密码:123456
[root@node-251 ~]# openstack role create admin
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | None |
| id | 25045c151e6e4642bd5b9c61ec56ac6f |
| name | admin |
+-----------+----------------------------------+
[root@node-251 ~]# openstack role add --project admin --user admin admin
[root@node-251 ~]# openstack project create --domain default --description "Service Project" service
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Service Project |
| domain_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled | True |
| id | a541e3766c284cb9b1a3ee77467309d4 |
| is_domain | False |
| name | service |
| parent_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| tags | [] |
+-------------+----------------------------------+
[root@node-251 ~]# openstack project create --domain default --description "Demo Project" demo
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Demo Project |
| domain_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled | True |
| id | 97ecef33235f473ba5f252af76bb89bb |
| is_domain | False |
| name | demo |
| parent_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| tags | [] |
+-------------+----------------------------------+
[root@node-251 ~]# openstack user create --domain default --password-prompt demo
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | f4e5187c3aef4288b6b2d97c292a69a2 |
| enabled | True |
| id | 93913e9669f34ea8a5db74256da105ec |
| name | demo |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
密码:123456
[root@node-251 ~]# openstack role create user
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | None |
| id | f3ce47e14e0141daada5c405b0db68d5 |
| name | user |
+-----------+----------------------------------+
[root@node-251 ~]# openstack role add --project demo --user demo user
[root@node-251 ~]# unset OS_TOKEN OS_URL
[root@node-251 ~]# openstack --os-auth-url http://openstack.if010.com:35357/v3 --os-project-domain-name default --os-user-domain-name default --os-project-name admin --os-username admin token issue
Password:
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2023-06-05T11:04:52+0000 |
| id | gAAAAABkfbNEhCAyAi8qLO7DejIkLnJ3-3nK7NU-HCVwRrDniTGWtrRE0sw40bgGZkeD1KIB1BaVDwJPes2rLhb4ym_LkbnaWWKWGIrA-YJ9-ywUaN6E-X9ICQ3-FdpeVyx6GfP8KlB93oYZ-dtmEuLIFEV3JULnw6tBFnOIrMDEQKp0vD-mmkA |
| project_id | 2aaf4155b00749b0a333a039c17c131c |
| user_id | 063ef7b979334fa5a86420952a141d32 |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@node-251 ~]# openstack --os-auth-url http://node-251:5000/v3 --os-project-domain-name default --os-user-domain-name default --os-project-name demo --os-username demo token issue
Password:
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2023-06-05T11:05:50+0000 |
| id | gAAAAABkfbN-qCLdLdphBmQeZS1Laqf9K4lKW8jLBPB2kt9OjEGuPBZ72FcfN0oK4FbJ1hQyAe7297O4W3Sof_QHGONJby4vSeHSmfMM1dR4tOHDtEwfKtQRJfoaXSV2f9OyPDycaW4_NLrlHMoCvrjXF2MXO-CUrYOHNnyDmHGQ_LvBHP_TxkE |
| project_id | 97ecef33235f473ba5f252af76bb89bb |
| user_id | 93913e9669f34ea8a5db74256da105ec |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@node-251 openstack]# vim admin-openrc
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_AUTH_URL=http://openstack.if010.com:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
[root@node-251 openstack]# vim demo-openrc
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=123456
export OS_AUTH_URL=http://openstack.if010.com:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
[root@node-251 openstack]# source admin-openrc
[root@node-251 openstack]# openstack token issue
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2023-06-06T02:09:25+0000 |
| id | gAAAAABkfodFFSQac25fPoUWNxyjSrJCS1FvonrWqe2-q_LL2ZV2A1TpwqPVAJuFO3pOpRIVCWxO4uzTCtVsLSdhUBnN6iOd_ATHy0nDycwYUiIcmDPxPUPz_s1_HpmRTh2hMd30dCCQKhcnHWwyBmyW8dqb5BYoQMx0Xw3P1xxAKC4YAOSmKWA |
| project_id | 2aaf4155b00749b0a333a039c17c131c |
| user_id | 063ef7b979334fa5a86420952a141d32 |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
创建一个项目(project),创建在指定的domain(域)中,指定描述信息,project名称为service(可使用openstack domain list 查询)
openstack project create --domain default --description "Service Project" service
创建角色(可使用openstack role list查看)
openstack role create user
查看openstack 角色列表
[root@node-251 openstack]# openstack role list
+----------------------------------+-------+
| ID | Name |
+----------------------------------+-------+
| 25045c151e6e4642bd5b9c61ec56ac6f | admin |
| f3ce47e14e0141daada5c405b0db68d5 | user |
+----------------------------------+-------+
查看是否可以不指定密码就可以获取到token信息(验证认证服务)
openstack token issue