1. 规划节点
安装基础服务的服务器规划
|----------------|------------|---------------|
| IP地址 | 主机名 | 节点 |
| 192.168.100.10 | controller | Openstack控制节点 |
2. 基础准备
使用机电云共享的单节点的openstack系统,自行修改虚拟网络编辑器、网络适配器,系统用户名:root,密码:000000。
1.安装基础服务
1.使用Moba或SecureCRT软件连接openstack系统,重启openstack服务及生效环境变量,使用浏览器登录云平台。
bash
[root@controller ~]# openstack-service restart
[root@controller ~]# source /etc/keystone/admin-openrc.sh

2. Keystone运维命令
(1)创建用户
创建一个名称为"alice"账户,密码为"mypassword123",邮箱为"alice@example.com"。命 令如下。
bash
[root@controller ~]# openstack user create --password mypassword123 --email alice@example.com --domain demo alice

从上面的操作可以看出,创建用户需要用户名称、密码和邮件等信息。具体格式如下:
bash
$openstack user create[--domain <domain>]
[--password <password>]
[--email <email-address>]
[--enable | --disable]
<name>
其中,参数代表新建用户名。
(2)创建项目
一个Project就是一个项目、团队或组织,当请求OpenStack服务时,必须定义一个项目。例如,查询 计算服务正在运行的云主机实例列表。创建一个名为"acme"项目。
bash
[root@controller ~]# openstack project create --domain demo acme

从上面操作可以看出,创建项目需要项目名等相关信息。具体操作格式如下:
bash
$ openstack project create [--domain <domain>]
[--description <description>]
[--enable | --disable]
<project-name>
其中,参数<project-name>代表新建项目名,参数代表项目描述名。
(3)创建角色
角色限定了用户的操作权限。例如,创建一个角色"compute-user"。
bash
[root@controller ~]# openstack role create compute-user

从上面操作可以看出,创建角色需要角色名称信息。具体命令格式如下。
bash
$ openstack user create <name>
其中参<name>代表角色名称。
(4)绑定用户和项目权限
添加的用户需要分配一定的权限,这就需要把用户关联绑定到对应的项目和角色。例如,给用户 "alice"分配"acme"项目下的"compute-user"角色,命令如下。
bash
[root@controller ~]# openstack role add --user alice --project acme compute-user
从上面操作可以看出,绑定用户权限需要用户名称、角色名称和项目名称等信息。具体命令格式如下。
bash
$ openstack role add--user <user>--project <project><role>
其中,参数<user>代表需要绑定的用户名称,参数<role>代表用户绑定的角色名称,参数 <project>代表用户绑定的项目名称。
3. Keystone基础查询命令
(1)用户列表查询
OpenStack平台所使用的用户可以通过Keystone组件进行查询。查询当前所有用户列表信息,命令如 下:
bash
[root@controller ~]# openstack user list

可以通过命令查询到具体用户的详细信息,可以查看到用户当前的状态,命令如下:
bash
[root@controller ~]# openstack user show alice

(2)项目列表查询
通过命令,可以查询所创建的项目"acme",也可以查询当前OpenStack平台中所有存在项目列表, 命令如下:
bash
[root@controller ~]# openstack project list

通过命令可以查询"acme"项目的详细信 息内容,命令如右。
bash
[root@controller ~]# openstack project show acme

(3)角色列表查询
通过命令查询创建的角色"compute-user", 通过Keystone组件查询角色列表信息,命令如下:
bash
[root@controller ~]# openstack role list

通过命令查询"compute-user"角色的详细信 息,命令如右:
bash
[root@controller ~]# openstack role show compute-user

(4)端点地址查询
Keystone组件管理OpenStack平台 中所有服务端点信息,通过命令可以查询 平台中所有服务所使用的端点地址信息, 命令如下:
bash
[root@controller ~]# openstack endpoint list

(5)删除
openstack role remove
命令需要提供角色、项目和用户信息来指定要移除的角色。你需要提供正确的角色、项目和用户信息。例如:
bash
[root@controller ~]# openstack role remove compute-user --project acme --user alice
openstack role remove <role_name> --project <project_name> --user <user_name_or_id>
bash
[root@controller ~]# openstack project delete acme
[root@controller ~]# openstack user delete alice

bash
[root@controller ~]# openstack-service status

bash
[root@controller ~]# openstack user create --password password --domain demo testuser
