Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active February 6, 2022 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilangvperdana/e74b3536c0c8786c68cb3ed51e4acbd2 to your computer and use it in GitHub Desktop.
Save gilangvperdana/e74b3536c0c8786c68cb3ed51e4acbd2 to your computer and use it in GitHub Desktop.
Installation OpenStack Victoria All-in-One on Cloud with Kolla Ansible

Installation OpenStack Victoria 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

pip install -U pip
pip install wheel
pip install 'ansible<2.10'

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

pip install 'kolla-ansible>=11,<12'

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_tag: "11.0.0"
kolla_internal_vip_address: "10.0.0.5"
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: "qemu"
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.5 -j DNAT --to-destination 10.0.2.155:22

NB : 10.0.0.5 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

Xena Version

https://gist.github.com/gilangvperdana/356296c8f4c6726859da290321087e71

Other

If you want to see my openstack installation article :
https://gilangvperdana.medium.com/list/openstack-916ca8cdc5cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment