More Related Content Similar to Build your own private openstack cloud Similar to Build your own private openstack cloud(20) Build your own private openstack cloud9. Network Time Protocol (NTP)
9
NTP
$ sudo apt-get install -y ntp
Controller Server /etc/ntp.conf
restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
server 2.tw.pool.ntp.org
server 3.asia.pool.ntp.org
server 0.asia.pool.ntp.org
Controller /etc/ntp.conf
server controller iburst
10. Network Time Protocol (NTP)
10
Controller
$ ntpq -c peers
+123.204.45.116 59.149.185.193 2 u 196 256 353 158.773 70.671 20.943
*186.211.189.118 203.123.48.219 2 u 215 256 377 59.255 -1.832 2.092
+time.iqnet.com 62.201.207.162 2 u 18 256 377 391.601 4.016 3.642
$ ntpq -c peers
*controller 10.0.0.11 3 u 47 64 37 0.308 -0.251 0.079
13. SQL database (1/2)
13
OpenStack SQL
Controller
$ sudo apt-get install -y mariadb-server python-mysqldb
/etc/mysql/conf.d/mysqld_openstack.cnf
[mysqld]
bind-address = 10.0.0.11
P.S. p@ssw0rd
14. SQL database (2/2)
14
...
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
$ sudo service mysql restart
$ sudo mysql_secure_installation
P.S. …
15. Message queue (1/2)
15
OpenStack Message Queue
RabbitMQ Controller
$ sudo apt-get install -y rabbitmq-server
web console
$ sudo rabbitmq-plugins enable rabbitmq_management
$ sudo sh -c "echo '[{rabbit, [{loopback_users, []}]}].' > /etc/rabbitmq/
rabbitmq.config"
$ sudo service rabbitmq-server restart
P.S. http://<ip>:15672 guest/guest
16. Message queue (2/2)
16
User OpenStack
$ sudo rabbitmqctl add_user openstack <password>
Creating user "openstack" ...
…done.
User
$ sudo rabbitmqctl set_permissions openstack ".*" ".*" “.*"
Setting permissions for user "openstack" in vhost "/" ...
...done.
P.S. p@ssw0rd
21. (1/2)
21
Identity Controller
Database Keystone
$ mysql -u root -p
# CREATE DATABASE keystone;
# GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'
IDENTIFIED BY 'keystone';
# GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED
BY 'keystone';
23. Keystone
23
$ echo "manual" | sudo tee /etc/init/keystone.override
Packaging-Deb apt-get keystone
$ sudo apt-get install keystone python-openstackclient apache2
libapache2-mod-wsgi memcached python-memcache
P.S. Kilo Keystone Eventlet WSGI Server
28. Apache2 HTTP (2/3)
28
<VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /var/www/cgi-bin/keystone/main
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
LogLevel info
ErrorLog /var/log/apache2/keystone-error.log
CustomLog /var/log/apache2/keystone-access.log combined
</VirtualHost>
29. Apache2 HTTP (3/3)
29
<VirtualHost *:35357>
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /var/www/cgi-bin/keystone/admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
LogLevel info
ErrorLog /var/log/apache2/keystone-error.log
CustomLog /var/log/apache2/keystone-access.log combined
</VirtualHost>
30. WSGI (1/2)
30
$ sudo ln -s /etc/apache2/sites-available/wsgi-keystone.conf /etc/apache2/sites-
enabled
WSGI WSGI
$ sudo mkdir -p /var/www/cgi-bin/keystone
$ sudo curl http://git.openstack.org/cgit/openstack/keystone/plain/httpd/
keystone.py?h=stable/liberty | sudo tee /var/www/cgi-bin/keystone/main /var/
www/cgi-bin/keystone/admin
31. WSGI(2/2)
31
chown chmod
$ sudo chown -R keystone:keystone /var/www/cgi-bin/keystone
$ sudo chmod 755 /var/www/cgi-bin/keystone/*
Apache2 SQLite
$ sudo service apache2 restart
$ sudo rm -f /var/lib/keystone/keystone.db
32. 32
export OS_TOKEN admin_token API
URL
$ export OS_TOKEN=1ed64bdb7ebda9ae6d01d811565d4d64
$ export OS_URL=http://10.0.0.11:35357/v2.0
$ openstack service create --name keystone --description "OpenStack
Identity" identity
33. API
33
API
API
$ openstack endpoint create --publicurl http://10.0.0.11:5000/v2.0
--internalurl http://10.0.0.11:5000/v2.0
--adminurl http://10.0.0.11:35357/v2.0
--region RegionOne identity
34. 34
Openstack domains,
projects (tenants), users roles admin Project User
Role
$ openstack project create --description "Admin Project" admin
$ openstack user create --password p@ssw0rd --email admin@example.com
admin
$ openstack role create admin
$ openstack role add --project admin --user admin admin
$ openstack project create --description "Service Project" service
P.S. p@ssw0rd
35. 35
Demo
$ openstack project create --description "Demo Project" demo
$ openstack user create --password demo --email
demo@example.com demo
$ openstack role create user
$ openstack role add --project demo --user demo user
P.S. demo
36. 36
Keystone
OS_TOKEN OS_URL
$ unset OS_TOKEN OS_URL
admin Identity v2.0 token
$ openstack --os-auth-url http://10.0.0.11:35357 --os-project-name admin
--os-username admin --os-auth-type password token issue
P.S. p@ssw0rd
37. admin client
37
admin demo
admin admin-openrc.sh
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=p@ssw0rd
export OS_AUTH_URL=http://10.0.0.11:35357/v3
P.S. p@ssw0rd
38. user client
38
demo demo-openrc.sh
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=demo
export OS_TENANT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=demo
export OS_AUTH_URL=http://10.0.0.11:5000/v3
P.S. demo
44. (1/2)
44
Image Service Controller
Database
$ mysql -u root -p
# CREATE DATABASE glance;
# GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost'
IDENTIFIED BY 'glance';
# GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY
'glance';
P.S. glance
45. (2/2)
45
Keystone admin
$ openstack user create --password glance --email glance@example.com
glance
$ openstack role add --project service --user glance admin
$ openstack service create --name glance --description "OpenStack Image
service" image
$ openstack endpoint create --publicurl http://10.0.0.11:9292
--internalurl http://10.0.0.11:9292
--adminurl http://10.0.0.11:9292 --region RegionOne image
P.S. glance
52. Glance (6/6)
52
[paste_deploy]
[paste_deploy]
flavor = keystone
/etc/glance/glance-api.conf /etc/glance/glance-registry.conf
SQLite
$ sudo glance-manage db_sync
$ sudo service glance-registry restart
$ sudo service glance-api restart
$ sudo rm -f /var/lib/glance/glance.sqlite
53. Glance
53
admin-openrc.sh demo-openrc.sh Glance API
$ echo "export OS_IMAGE_API_VERSION=2" | sudo tee -a admin-openrc.sh demo-
openrc.sh
$ source admin-openrc.sh
Glance
$ wget -P /tmp/images http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-
disk.img
$ glance image-create --name "cirros-0.3.4-x86_64" --file cirros-0.3.4-x86_64-
disk.img --disk-format qcow2 --container-format bare --visibility public --progress
58. (1/2)
58
Compute Controller
Compute Controller
$ mysql -u root -p
# CREATE DATABASE nova;
# GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY
'nova';
# GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova';
P.S. nova
59. (2/2)
59
Keystone admin
$ openstack user create --password nova --email nova@example.com nova
$ openstack role add --project service --user nova admin
$ openstack service create --name nova --description "OpenStack Compute" compute
$ openstack endpoint create --publicurl http://10.0.0.11:8774/v2/%(tenant_id)s
--internalurl http://10.0.0.11:8774/v2/%(tenant_id)s
--adminurl http://10.0.0.11:8774/v2/%(tenant_id)s
--region RegionOne compute
P.S. nova
65. 65
Nova SQLite
$ sudo service nova-api restart
$ sudo service nova-cert restart
$ sudo service nova-consoleauth restart
$ sudo service nova-scheduler restart
$ sudo service nova-conductor restart
$ sudo service nova-novncproxy restart
$ sudo rm -f /var/lib/nova/nova.sqlite
74. Nova-Compute (2/5)
74
[vnc] VNC Server
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = 10.0.0.31
novncproxy_base_url = http://10.0.0.11:6080/vnc_auto.html
76. Nova-Compute (4/5)
76
[keystone_authtoken] VNC Server
auth_uri = http://10.0.0.11:5000
auth_url = http://10.0.0.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
P.S. Keystone nova
85. (1/2)
85
Networking Controller Network
Compute Controller
$ mysql -u root -p
# CREATE DATABASE neutron;
# GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost'
IDENTIFIED BY 'neutron';
# GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY
'neutron';
P.S. neutron
86. (2/2)
86
Keystone admin
$ openstack user create --password neutron --email neutron@example.com neutron
$ openstack role add --project service --user neutron admin
$ openstack service create --name neutron --description "OpenStack Networking"
network
$ openstack endpoint create --publicurl http://10.0.0.11:9696
--adminurl http://10.0.0.11:9696
--internalurl http://10.0.0.11:9696
--region RegionOne network
P.S. neutron
89. Neutron (2/4)
89
[database]
[DEFAULT]
connection = mysql://neutron:neutron@10.0.0.11/neutron
[oslo_messaging_rabbit]
[oslo_messaging_rabbit]
rabbit_host = 10.0.0.11
rabbit_userid = openstack
rabbit_password = p@ssw0rd
P.S. MySQL neutron rabbit p@ssw0rd
91. Neutron (4/4)
91
[nova]
[nova]
auth_uri = http://10.0.0.11:5000
auth_url = http://10.0.0.11:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
P.S. nova
92. Modular Layer 2 (1/2)
92
/etc/neutron/plugins/ml2/ml2_conf.ini [ml2]
GRE OVS
[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch
101. Modular Layer 2 (2/2)
101
[ml2_type_gre] id
[ml2_type_gre]
tunnel_id_ranges = 1:1000
[securitygroup] ipset OVS iptables
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
102. Nova Networking(1/2)
102
/etc/nova/nova.conf [DEFAULT] APIs
Drivers
[DEFAULT]
...
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
104. 104
$ sudo neutron-db-manage --config-file /etc/neutron/neutron.conf --
config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade liberty
Compute Networking SQLite
$ sudo service nova-api restart
$ sudo service neutron-server restart
$ sudo rm -f /var/lib/neutron/neutron.sqlite
110. Neutron (2/3)
110
[database]
[DEFAULT]
# connection = sqlite:////var/lib/neutron/neutron.sqlite
[oslo_messaging_rabbit]
[oslo_messaging_rabbit]
rabbit_host = 10.0.0.11
rabbit_userid = openstack
rabbit_password = p@ssw0rd
P.S. MySQL neutron rabbit p@ssw0rd
112. Modular Layer 2 (1/4)
112
/etc/neutron/plugins/ml2/ml2_conf.ini [ml2]
GRE OVS
[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch
113. Modular Layer 2 (2/4)
113
[ml2_type_flat]
[ml2_type_flat]
flat_networks = external
[ml2_type_gre] id
[ml2_type_gre]
tunnel_id_ranges = 1:1000
114. Modular Layer 2 (3/4)
114
[securitygroup] ipset OVS iptables
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
[ovs] IP
[ovs]
local_ip = 10.0.1.21
bridge_mappings = external:br-ex
117. DHCP Proxy(1/2)
117
/etc/neutron/dhcp_agent.ini [DEFAULT] DHCP
[DEFAULT]
...
verbose = True
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
dhcp_delete_namespaces = True
dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
122. Nova Metadata Proxy
122
/etc/nova/nova.conf [neutron] Nova metadata proxy
[neutron]
...
service_metadata_proxy = True
metadata_proxy_shared_secret = d88ec459ab1e0bdaf5d8
Controller Compute API
$ sudo service nova-api restart
P.S. metadata_proxy_shared_secret d88ec459ab1e0bdaf5d8
124. Open vSwitch (OVS)
124
Open vSwitch
$ sudo service openvswitch-switch restart
$ sudo ovs-vsctl add-br br-ex
$ sudo ovs-vsctl add-port br-ex INTERFACE_NAME
P.S. INTERFACE_NAME Public eth1
125. Networking
125
$ sudo service neutron-plugin-openvswitch-agent restart
$ sudo service neutron-l3-agent restart
$ sudo service neutron-dhcp-agent restart
$ sudo service neutron-metadata-agent restart
Controller Keystone admin
$ neutron agent-list
130. Neutron (2/3)
130
[database]
[DEFAULT]
# connection = sqlite:////var/lib/neutron/neutron.sqlite
[oslo_messaging_rabbit]
[oslo_messaging_rabbit]
rabbit_host = 10.0.0.11
rabbit_userid = openstack
rabbit_password = p@ssw0rd
P.S. MySQL neutron rabbit p@ssw0rd
132. Modular Layer 2 (1/3)
132
/etc/neutron/plugins/ml2/ml2_conf.ini [ml2]
GRE OVS
[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch
133. Modular Layer 2 (2/3)
133
[ml2_type_gre] id
[ml2_type_gre]
tunnel_id_ranges = 1:1000
[securitygroup] ipset OVS iptables
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
134. Modular Layer 2 (3/3)
134
[ovs] IP
[ovs]
local_ip = 10.0.1.31
[agent] GRE
[agent]
tunnel_types = gre
135. Compute Networking(1/2)
135
/etc/nova/nova.conf [DEFAULT] APIs Drivers
[DEFAULT]
...
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver =
nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
137. Compute Networking
137
$ sudo service openvswitch-switch restart
$ sudo service nova-compute restart
$ sudo service neutron-plugin-openvswitch-agent restart
Controller Keystone admin
$ neutron agent-list
146. 146
$ sudo service apache2 reload
$ sudo service apache2 restart
http://10.0.011/horizon