Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active February 2, 2024 13:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gilangvperdana/356296c8f4c6726859da290321087e71 to your computer and use it in GitHub Desktop.
Save gilangvperdana/356296c8f4c6726859da290321087e71 to your computer and use it in GitHub Desktop.
Installation OpenStack Xena All-in-One on Cloud with Kolla Ansible

Installation OpenStack Xena on VM Cloud

Environment

1. Virtual Machine Ubuntu 20.04LTS (Azure, GCP, AWS, Aliyun, etc)
2. 16GB RAM
3. 512 GB Storage
4. One disk add for PV

Prepare

sudo apt update -y && sudo apt-get full-upgrade -y

Create Dummy Interface

sudo ip tuntap add mode tap br_ex_port
sudo ip link set dev br_ex_port up

Define on Hosts file

sudo tee /etc/hosts << EOT
$(hostname -i) $(hostname)
EOT

Prepare Kolla User

Add User :
adduser kolla
usermod -aG sudo kolla
echo "kolla ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/kolla

su - kolla

Create a PV

sudo pvcreate /dev/sdc
sudo vgcreate cinder-volumes /dev/sdc
sudo vgs

Install Dependencies

sudo apt-get install python3-dev libffi-dev gcc libssl-dev python3-selinux python3-setuptools python3-venv -y

Create a Virtual Environment

python3 -m venv kolla-venv
source kolla-venv/bin/activate

Install some pip package

apt install -y python3-docker
pip install -U pip
pip install wheel
pip install 'ansible<3.0'

Config ansible.cfg

sudo mkdir -p /etc/ansible
sudo nano /etc/ansible/ansible.cfg
[defaults]
host_key_checking=False
pipelining=True
forks=100

Install Kolla-Ansible

You can see the support version on :
https://releases.openstack.org/teams/kolla.html
pip install 'kolla-ansible==13.0.1'

Create Kolla Directory

sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla

Copy some file & dir

cp -r kolla-venv/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
cp kolla-venv/share/kolla-ansible/ansible/inventory/* .

Check Configuration is correct or not

ansible -i all-in-one all -m ping

Generate Password and change to "kolla"

kolla-genpwd
sed -i 's#keystone_admin_password:.*#keystone_admin_password: kolla#g' /etc/kolla/passwords.yml

Edit globals.yml

nano /etc/kolla/globals.yml
You can use "qemu" or "kvm"

if using "kvm", make sure Nested Virtualization is on.
To check : 
cat /sys/module/kvm_intel/parameters/nested
Y is activated.
kolla_base_distro: "ubuntu"
kolla_install_type: "source"
openstack_release: "xena"
kolla_internal_vip_address: "10.0.0.4"
network_interface: "eth0"
neutron_external_interface: "br_ex_port"
enable_openstack_core: "yes"
enable_haproxy: "no"
enable_neutron_provider_networks: "yes"
nova_compute_virt_type: "kvm"
enable_cinder: "yes"
enable_cinder_backend_lvm: "yes"
cinder_volume_group: "cinder-volumes"
kolla_internal_vip_address is your ip-eth0

Run Kolla Ansible

kolla-ansible -i ./all-in-one bootstrap-servers
kolla-ansible -i ./all-in-one prechecks
kolla-ansible -i ./all-in-one deploy
kolla-ansible post-deploy

Install Openstack Client

On Virtual Environment :
pip install python-openstackclient
pip install python-magnumclient

On OS :
apt install python3-openstackclient

Verification

source /etc/kolla/admin-openrc.sh
openstack server list

Access Dashboard

Access on your_vm_ip

Username : admin
Password : kolla

Public Network

TYPE : flat
physnet1

Init some First Instance

export EXT_NET_CIDR='10.0.2.0/24'
export EXT_NET_RANGE='start=10.0.2.150,end=10.0.2.199'
export EXT_NET_GATEWAY='10.0.2.1'
source /etc/kolla/admin-openrc.sh
./kolla-venv/share/kolla-ansible/init-runonce

IP Route for Instance Internet Access

sudo ifconfig br-ex $EXT_NET_GATEWAY netmask 255.255.255.0 up
sudo iptables -t nat -A POSTROUTING -s $EXT_NET_CIDR -o eth0 -j MASQUERADE

What to do when restarting OpenStack Cluster

sudo ip tuntap add mode tap br_ex_port
sudo ip link set dev br_ex_port up
export EXT_NET_CIDR='10.0.2.0/24'
export EXT_NET_RANGE='start=10.0.2.150,end=10.0.2.199'
export EXT_NET_GATEWAY='10.0.2.1'
sudo ifconfig br-ex $EXT_NET_GATEWAY netmask 255.255.255.0 up
sudo iptables -t nat -A POSTROUTING -s $EXT_NET_CIDR -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -o eth0 -i br-ex -j ACCEPT
iptables -A FORWARD -i eth0 -o br-ex -j ACCEPT

Destroy Cluster

You can simply destroy your openstack cluster with :
kolla-ansible -i all-in-one destroy

Port Forwarding

You can forward Instance IP to another port on your VM Public IP.

For example i want to forward Instance IP on 10.0.2.155:22 to Your_VM_Public_IP:2000
So, you can do this :
$ iptables -t nat -A PREROUTING -p tcp --dport 2000 -d 10.0.0.4 -j DNAT --to-destination 10.0.2.155:22

NB : 10.0.0.4 is your eth0 VM && 10.0.2.155 is your Instance floating IP
Now, you can access your Instance SSH publicly on Your_VM_Public_IP:2000

Victoria Version

https://gist.github.com/gilangvperdana/e74b3536c0c8786c68cb3ed51e4acbd2

Other

If you want to see my openstack installation article :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment