OpenStack, KVM, OVS: Compute Node (Part 3)

The Compute Node

We will use Ubuntu Server 16.04.3 LTS. Please change the interface name to reflect your host NIC. A compute node needs to run only following services and subsystems:

Nova: 
nova compute
Neutron: 
neutron openvswitch agent
neutron metadata agent
neutron l3 agent
neutron dhcp agent

Let’s start

#this command will save a lot of time: 

sudo su root
#disable firewall:

ufw disable
#edit interface setting: 

vim /etc/network/interfaces  

#paste, change interface name matching your host NIC: 

auto eno1 
iface eno1 inet static
          address 192.168.2.11
          network 255.255.255.0
          gateway 192.168.2.1
          dns-nameservers 8.8.8.8
#restart networking:

/etc/init.d/network restart
#change hostname:

vim /etc/hostname

#paste:

controller
#edit:

vim /etc/hosts

#paste:

192.168.1.11 controller 
192.168.2.11 compute
#install NTP:

apt install chrony
service chrony restart
#update everything and reboot:

apt-get update & dist-upgrade -y
reboot
#install libvirt tool:

apt install libvirt-bin
#clone the Openstack directory:

apt install software-properties-common
add-apt-repository cloud-archive:newton
#again update everything and reboot:

apt update && apt dist-upgrade -y
reboot
#install python installer for Openstack:

apt install python-openstackclient

Nova

#install nova-compute and configure:

apt install nova-compute -y
#create congfiguration file:

mv /etc/nova/nova.conf /etc/nova/nova.conf.old
vim /etc/nova/nova.conf
#paste following:

[DEFAULT]
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
log-dir=/var/log/nova
state_path=/var/lib/nova
force_dhcp_release=True
verbose=True
ec2_private_dns_show_ip=True
enabled_apis=osapi_compute,metadata
transport_url = rabbit://openstack:changemenow@controller
auth_strategy = keystone
my_ip = 192.168.2.11
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
compute_driver = libvirt.LibvirtDriver

[database]
connection = mysql+pymysql://nova:changemenow@controller/nova

[api_database]
connection = mysql+pymysql://nova:changemenow@controller/nova_api

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

[libvirt]
use_virtio_for_bridges=True

[wsgi]
api_paste_config=/etc/nova/api-paste.ini

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = changemenow

[vnc]
enabled = True
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

[glance]
api_servers = http://controller:9292
#nova-compute configuration file:

mv /etc/nova/nova-compute.conf /etc/nova/nova-compute.conf.old
vim /etc/nova/nova-compute.conf
#paste following:

[DEFAULT]
compute_driver=libvirt.LibvirtDriver

[libvirt]
virt_type=kvm
#restart nova-compute:

service nova-compute restart
#verfiy, you should see both controller and compute nodes:

openstack compute service list

Neutron

#install OVS and neutron-agents:

apt install openvswitch-switch -y
apt install neutron-plugin-openvswitch-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent
#create configuration: 

mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.old  
vim /etc/neutron/neutron.conf
#paste following:

[DEFAULT]
auth_strategy = keystone
transport_url = rabbit://openstack:changemenow@controller

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = changemenow

[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
#create ovs agent configuration file:

mv /etc/neutron/plugins/ml2/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini.old
vim /etc/neutron/plugins/ml2/openvswitch_agent.ini
#paste following:

[ovs]
local_ip = 192.168.2.11

[agent]
tunnel_types = vxlan
l2_population = True
prevent_arp_spoofing = True

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = True
#create DHCP agent configuration file:

mv /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.old
vim /etc/neutron/dhcp_agent.ini
#paste:

[DEFAULT]
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
interface_driver = openvswitch
[AGENT]
#create metadata agent configuration file:

mv /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.old
vim /etc/neutron/metadata_agent.ini
#paste:

[DEFAULT]
nova_metadata_ip = controller
metadata_proxy_shared_secret = changemenow
[AGENT]
[cache]
#create L3 agent configuration:

mv /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini.old
vim /etc/neutron/l3_agent.ini
#paste following, 
#as per neutron documentation external_network_bridge 
#intentioannly do not have any value

[DEFAULT]
interface_driver = openvswitch
enable_isolated_metadata = True
external_network_bridge =
#restart ovs and neutron service:  

/etc/init.d/openvswitch-switch restart 
service neutron-dhcp-agent restart 
service neutron-metadata-agent restart 
service neutron-l3-agent restart

#verify neutron, you should see both controller and  
#compute nodes
 
openstack network agent list

Troubleshooting

Verify the following logs in case of issue:
 Logs  Service
 

/var/log/apache2/error.log
/var/log/apache2/access.log
/var/log/apache2/keystone_wsgi_admin_access.log
/var/log/apache2/keystone_wsgi_admin_error.log
/var/log/apache2/keystone_wsgi_main_access.log
/var/log/apache2/keystone_wsgi_main_error.log
 Keystone
 

/var/log/apache2/error.log
/var/log/apache2/access.log
/var/log/apache2/horizon_access.log
/var/log/apache2/horizon_error.log
 Horizon
 

/var/log/syslog
/var/log/mysql/error.log
 MySQL
 

/var/log/rabbitmq/rabbit@controller-sasl.log
/var/log/rabbitmq/ rabbit@controller.log
 RabbitMQ
/var/log/nova/nova-api.log
/var/log/nova/nova-compute.log
/var/log/nova/nova-conductor.log
/var/log/nova/nova-conductor.log
/var/log/nova/nova-scheduler.log
 Nova
/var/log/glance/glance-api.log
/var/log/glance/glance-registry.log
Glance 
/var/log/neutron/neutron-l3-agent.log
/var/log/neutron/neutron-dhcp-agent.log
/var/log/neutron/neutron-openvswitch-agent.log
/var/log/neutron/neutron-server.log
/var/log/neutron/neutron-metadata-agent.log
 Neutron
Back to Part 1: Controller Node

This ends the tutorial.