Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active June 17, 2024 08:31
Show Gist options
  • Save gilangvperdana/82b35379eeccdad86c7e0b2143eba341 to your computer and use it in GitHub Desktop.
Save gilangvperdana/82b35379eeccdad86c7e0b2143eba341 to your computer and use it in GitHub Desktop.
Deploy Openstack Caracal Single Node on Ubuntu Jammy with Kolla Ansible

General

I just want to deploy an Openstack Caracal Version (you can follow the update of Openstack Release on here) on my Ubuntu Jammy as LAB. I do on VirtualBox. You can see my previous article here, i just deploy Openstack Xena on Ubuntu Focal in Cloud/VM.

Goals

  • I want to deploy single node with all role of Openstack (Management & Compute) Caracal on branch Master on top of Ubuntu Jammy (22.04LTS) on VirtualBox
  • I want to access with FQDN os.test.link for External & osint.test.link for Internal FQDN
  • I want to use secondary Disk for VM Volumes (Cinder)
  • I want to makesure all service call with TLS
  • I want to login to horizon with kolla password
  • I want to deploy monitoring but just prometheus agent, cause the Grafana i already have existing

All that point please reffer to /etc/kolla/globals.yml configuration below.

Prerequisites

  • 3 NIC
    • NIC 1 -> NAT (enp0s3)
    • NIC 2 -> Host Only Adapter (enp0s8)
    • NIC 3 -> Bridge Mode (enp0s9)
  • 50 GB for /dev/sda
  • 50 GB for /dev/sdb
  • 4 VCPU
  • 8GB RAM
  • Ubuntu Jammy (22.04 LTS)

Set /etc/hosts

192.168.56.2 osint.gbesar.link
192.168.56.3 os.gbesar.link

Set hostname

hostnamectl set-hostname node1

Set netplan to persistent configuration

network:
    ethernets:
        enp0s3:
            dhcp4: true
            set-name: enp0s3
        enp0s8:
            dhcp4: true
        enp0s9: {}
    version: 2

Upgrade you Package first

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

Define on Hosts file

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

Create PV for Volume Instance (Glance) -> Optional

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

You can see on here for VG/PV/LV on Linux Concept/LAB

Install Dependencies

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

Create Virtual Environment

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

Install Some Pip Packages

apt install -y python3-docker
pip install -U pip
pip install wheel
pip install 'ansible-core>=2.15,<2.16.99'

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 reffer to here. We will try to deploy Caracal version so we can use kolla-ansible==18.0.0

pip install 'kolla-ansible==18.0.0'

Create Kolla Directory

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

Copy Template Kolla file

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

  • Please read this for nova_compute_virt_type
    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.
    
nano /etc/kolla/globals.yml
## general
kolla_base_distro: "ubuntu"
kolla_install_type: "source"
openstack_release: "master"
kolla_internal_vip_address: "192.168.56.2"
kolla_external_vip_address: "192.168.56.3"
network_interface: "enp0s8"
neutron_external_interface: "enp0s9"
enable_openstack_core: "yes"
enable_haproxy: "no"
enable_neutron_provider_networks: "yes"
nova_compute_virt_type: "qemu"

## fqdn
kolla_external_fqdn: "os.test.link"
kolla_internal_fqdn: "osint.test.link"

## cinder
enable_cinder: "yes"
enable_cinder_backend_lvm: "yes"
cinder_volume_group: "cinder-volumes"
enable_cinder_backup: "no"

## tls 
kolla_enable_tls_external: "yes"
kolla_copy_ca_into_containers: "yes"
openstack_cacert: "/etc/ssl/certs/ca-certificates.crt"
kolla_enable_tls_internal: "yes"
kolla_enable_tls_backend: "yes"

## monitoring
enable_prometheus: "yes"
enable_prometheus_openstack_exporter: "yes"
enable_grafana: "no"
enable_prometheus_node_exporter: "no"

Run Kolla Ansible

kolla-ansible install-deps
kolla-ansible -i ./all-in-one certificates
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

we can use template admin-openrc.sh from /etc/kolla/

cp /etc/kolla/admin-openrc* /root/
source admin-openrc.sh
source admin-opnerc-system.sh

## Test Network Component
openstack network agent list

If you want to use Openstack CLI, you must have kolla root certificate, you can use this template for admin-openrc.sh & admin-openrc-system.sh. Please add this on bottom of admin-openrc.sh

export OS_CACERT=/etc/kolla/certificates/ca/root.crt

Verification

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

Access Dashboard

You can access with kolla_external_fqdn / kolla_internal_fqdn or kolla_internal_vip_address / kolla_external_vip_address

Username : admin
Password : kolla

Public Network

TYPE : flat
physnet1

Evidence after Deploy (Tested on 15/06/2024)

  • All Service running on Docker image

  • Horizon image

  • Network Agent image

  • Compute Service image

  • Volume Service
    image

Reference

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