YJWANG

OpenStack Installation on Single Node (kolla) 본문

60.Cloud/60.OpenStack

OpenStack Installation on Single Node (kolla)

왕영주 2021. 3. 9. 17:23

OpenStack Installation on Single Node


https://docs.openstack.org/kolla-ansible/latest/user/quickstart.html

Network는 상황에 맞게 사용하기시바랍니다.

 

Control node Interface 정보

** ens2와 ens4에는 IP가 사전에 설정이돼있어야합니다.

ens2 : management
ens3 : provider network (same network as management)
ens4 : external network (for managing)

 

 

Prerequisite


Update package index

root@yjwang0-stack-11:~# apt update

 

Install python dependencies

root@yjwang0-stack-11:~# apt install -y python3-dev libffi-dev gcc libssl-dev

 

Install dependencies not using a virtual env

root@yjwang0-stack-11:~# apt install -y python3-pip

 

Install Ansible (Require at least 2.9 ver)

root@yjwang0-stack-11:~# apt -y install ansible
root@yjwang0-stack-11:~# ansible --version
ansible 2.9.6

 

Clone kolla , kolla-ansible git

root@yjwang0-stack-11:~# git clone https://github.com/openstack/kolla
root@yjwang0-stack-11:~# git clone https://github.com/openstack/kolla-ansible

 

Install requirements of kolla and kolla-ansible:

root@yjwang0-stack-11:~# pip3 install ./kolla
root@yjwang0-stack-11:~# pip3 install ./kolla-ansible

 

create /etc/koll dir

root@yjwang0-stack-11:~# mkdir -p /etc/kolla
root@yjwang0-stack-11:~# chown $USER:$USER /etc/kolla

root@yjwang0-stack-11:~# ls -ld /etc/kolla/
drwxr-xr-x 2 root root 4096 Mar  4 13:32 /etc/kolla/

 

copy file for installation

cp -r kolla-ansible/etc/kolla/* /etc/kolla
cp kolla-ansible/ansible/inventory/* .

 

 

Config Ansible


ansible config file

root@yjwang0-stack-11:~# cat ./ansible.cfg 
[defaults]
host_key_checking=False
pipelining=True
forks=100

 

check current config file path

root@yjwang0-stack-11:~# ansible --version
ansible 2.9.6
  config file = /root/ansible.cfg
...

 

confirm connection

root@yjwang0-stack-11:~# ansible -i all-in-one all -m ping

 

Gen kolla password

root@yjwang0-stack-11:~# python3 ./kolla-ansible/tools/generate_passwords.py
root@yjwang0-stack-11:~# cat /etc/kolla/passwords.yml |grep keystone_admin_password
keystone_admin_password: pNXfHhvua8cC0ILxCuwaYimevCmIBLgPcSXQxKNP

 

Create Cinder LVM Volume Group

root@yjwang0-stack-11:~# lsblk /dev/vda
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
vda  252:0    0 186.3G  0 disk 

root@yjwang0-stack-11:~# vgcreate cinder-volumes /dev/vda
  Physical volume "/dev/vda" successfully created.
  Volume group "cinder-volumes" successfully created

 

kolla globals.yml

root@yjwang0-stack-11:~# vim /etc/kolla/globals.yml 
root@yjwang0-stack-11:~/kolla-ansible/tools# grep -Ev '^$|^#' /etc/kolla/globals.yml
---
kolla_base_distro: "ubuntu"
kolla_install_type: "source"
openstack_release: "master"
kolla_internal_vip_address: "10.99.99.190"
kolla_external_vip_address: "xxx.xxx.xxx.190"
network_interface: "ens2"
kolla_external_vip_interface: "ens4"
neutron_external_interface: "ens3"
enable_openstack_core: "yes"
enable_cinder: "yes"
enable_cinder_backend_lvm: "yes"
cinder_backend_ceph: "no"
cinder_backend_vmwarevc_vmdk: "no"
cinder_volume_group: "cinder-volumes"

 

 

Deploy


bootstrap servers

root@yjwang0-stack-11:~# cd kolla-ansible/tools/
root@yjwang0-stack-11:~/kolla-ansible/tools# ./kolla-ansible -i ../../all-in-one bootstrap-servers

 

Do pre-deployment checks for hosts:

root@yjwang0-stack-11:~/kolla-ansible/tools# ./kolla-ansible -i ../../all-in-one prechecks

 

Finally proceed to actual OpenStack deployment:

root@yjwang0-stack-11:~/kolla-ansible/tools# ./kolla-ansible -i ../../all-in-one deploy

 

Check OpenStack Containers

root@yjwang0-stack-11:~# docker ps
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED              STATUS                             PORTS     NAMES
ab04b7dfb274   kolla/ubuntu-source-horizon:master                     "dumb-init --single-…"   18 seconds ago       Up 13 seconds (health: starting)             horizon
05155fbd3b4c   kolla/ubuntu-source-heat-engine:master                 "dumb-init --single-…"   57 seconds ago       Up 55 seconds (healthy)                      heat_engine
...
...

 

 

Using Openstack


root@yjwang0-stack-11:~# pip3 install python-openstackclient

 

Create openrc file

root@yjwang0-stack-11:~# cd kolla-ansible/tools/
root@yjwang0-stack-11:~/kolla-ansible/tools# ./kolla-ansible post-deploy

 

Check

root@yjwang0-stack-11:~# . /etc/kolla/admin-openrc.sh 
root@yjwang0-stack-11:~/kolla-ansible/tools# openstack host list
+------------------+-----------+----------+
| Host Name        | Service   | Zone     |
+------------------+-----------+----------+
| yjwang0-stack-11 | scheduler | internal |
| yjwang0-stack-03 | scheduler | internal |
| yjwang0-stack-02 | scheduler | internal |
| yjwang0-stack-11 | conductor | internal |
| yjwang0-stack-03 | conductor | internal |
| yjwang0-stack-02 | conductor | internal |
| yjwang0-stack-05 | compute   | nova     |
| yjwang0-stack-04 | compute   | nova     |
+------------------+-----------+----------+

 

[option] create example networks, images, etc

Edit Network Information

root@yjwang0-stack-11:~/kolla-ansible/tools# grep -iE '(ext_net).*=' init-runonce 
ENABLE_EXT_NET=${ENABLE_EXT_NET:-1}
EXT_NET_CIDR=${EXT_NET_CIDR:-'10.0.2.0/24'}
EXT_NET_RANGE=${EXT_NET_RANGE:-'start=10.0.2.150,end=10.0.2.199'}
EXT_NET_GATEWAY=${EXT_NET_GATEWAY:-'10.0.2.1'}

 

Run scripts

root@yjwang0-stack-11:~/kolla-ansible/tools# ./init-runonce

 

[option] bash completion

root@yjwang0-stack-11:~/kolla-ansible/tools# openstack complete > /etc/bash_completion.d/osc
[재접속]

 

Open V switch 확인

root@yjwang0-stack-11:~# docker exec -it openvswitch_db ovs-vsctl list-br
br-ex
br-int
br-tun

root@yjwang0-stack-11:~# docker exec -it openvswitch_db ovs-vsctl list-ports br-ex
ens3
phy-br-ex

 

Openstack Commands

Create Image

root@yjwang0-stack-11:~/images# openstack image create --shared --disk-format qcow2 --file ubuntu-2004.qcow2 ubuntu-2004.qcow2 
root@yjwang0-stack-11:~/images# openstack image create --shared --disk-format qcow2 --file centos-83.qcow2 centos-83.qcow2

 

Create Network (provider)

root@yjwang0-stack-11:~# openstack network create --share --provider-physical-network physnet1 --provider-network-type flat --external provider

root@yjwang0-stack-11:~# openstack subnet create --dhcp --gateway 10.99.99.1 --network provider --subnet-range 10.99.99.0/24 --allocation-pool start=10.99.99.99,end=10.99.99.200 provider-subnet

 

Create Key Pair

root@yjwang0-stack-11:~# ls -l .ssh/id_rsa.pub 
-rw-r--r-- 1 root root 575 Mar  9 14:18 .ssh/id_rsa.pub

root@yjwang0-stack-11:~# openstack keypair create --public-key .ssh/id_rsa.pub host-root-key

 

Create Flavor

root@yjwang0-stack-11:~# openstack flavor create --vcpus 2 --ram 4096 --disk 20 2-4096-20G

 

Create Instance

root@yjwang0-stack-11:~# openstack server create --image ubuntu-2004.qcow2 --key-name host-root-key --flavor 2-4096-20G --network provider test-ubuntu

 

Create Security group rules

root@yjwang0-stack-11:~# openstack security group rule create --protocol icmp --ingress 43a3cd85-a8ed-496b-9180-719e06e6c835
root@yjwang0-stack-11:~# openstack security group rule create --protocol tcp --dst-port 22 --ingress 43a3cd85-a8ed-496b-9180-719e06e6c835
반응형