YJWANG

Install OpenStack self-service (with kolla-ansible / without python-virtual-env) 본문

60.Cloud/60.OpenStack

Install OpenStack self-service (with kolla-ansible / without python-virtual-env)

왕영주 2021. 3. 9. 13:11

Install OpenStack self-service (with kolla-ansible / without python-virtual-env)


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

Minimal (Only core service) and self-service / provider network interface

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

Control node Interface 정보

ens2 : provider (management net)
ens3 : tanent
ens4 : ceph
ens5 : external

Prerequisite


Update package index

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

Install python dependencies

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

Install dependencies not using a virtual env

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

Install Ansible (Require at least 2.9 ver)

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

Clone kolla , kolla-ansible git

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

Install requirements of kolla and kolla-ansible:

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

create /etc/koll dir

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

root@yjwang0-stack-01:~# 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-01:~# cat ./ansible.cfg 
[defaults]
host_key_checking=False
pipelining=True
forks=100

check current config file path

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

inventory

root@yjwang0-stack-01:~# head -200 multinode 
# These initial groups are the only groups required to be modified. The
# additional groups are for more control of the environment.
[control]
# These hostname must be resolvable from your deployment host
control01 ansible_host=10.99.58.20 
control02 ansible_host=10.99.58.21
control03 ansible_host=10.99.58.22

# The above can also be specified as follows:
#control[01:03]     ansible_user=kolla

# The network nodes are where your l3-agent and loadbalancers will run
# This can be the same as a host in the control group
[network]
control01 ansible_host=10.99.58.20 
control02 ansible_host=10.99.58.21
control03 ansible_host=10.99.58.22

[compute]
compute01 ansible_host=10.99.58.23
compute02 ansible_host=10.99.58.24

[monitoring]
#monitoring01

# When compute nodes and control nodes use different interfaces,
# you need to comment out "api_interface" and other interfaces from the globals.yml
# and specify like below:
#compute01 neutron_external_interface=eth0 api_interface=em1 storage_interface=em1 tunnel_interface=em1

[storage]
#storage01

[deployment]
localhost       ansible_connection=local

...(이하 default)

confirm connection

root@yjwang0-stack-01:~# apt install sshpass
or
root@yjwang0-stack-01:~# ssh-keygen -N "" -f /root/.ssh/id_rsa
root@yjwang0-stack-01:~# for i in 20 21 22 23 24;do ssh-copy-id 10.99.58.$i;done

root@yjwang0-stack-01:~# ansible -i multinode all -m ping

Gen kolla password

root@yjwang0-stack-01:~# kolla-genpwd
root@yjwang0-stack-01:~# cat /etc/kolla/passwords.yml |grep keystone_admin_password
keystone_admin_password: pNXfHhvua8cC0ILxCuwaYimevCmIBLgPcSXQxKNP

kolla globals.yml

root@yjwang0-stack-01:~# vim /etc/kolla/globals.yml 
root@yjwang0-stack-01:~# grep -Ev '^$|^#' /etc/kolla/globals.yml 
---
kolla_base_distro: "ubuntu"
kolla_install_type: "source"
kolla_internal_vip_address: "xxx.xxx.xxx.xxx"
network_interface: "ens5" # mgmt
tunnel_interface: "ens3" # tanent
neutron_external_interface: "ens2" # provider
enable_openstack_core: "yes"

Deploy


bootstrap servers

root@yjwang0-stack-01:~# kolla-ansible -i ../../multinode bootstrap-servers

Do pre-deployment checks for hosts:

root@yjwang0-stack-01:~# kolla-ansible -i ../../multinode prechecks

Finally proceed to actual OpenStack deployment:

root@yjwang0-stack-01:~# kolla-ansible -i ../../multinode deploy

Check OpenStack Containers

root@yjwang0-stack-01:~# docker ps
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED        STATUS                  PORTS     NAMES
341347c933cc   kolla/ubuntu-source-horizon:master                     "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             horizon
45b185ad697d   kolla/ubuntu-source-heat-engine:master                 "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             heat_engine
564f812be6cc   kolla/ubuntu-source-heat-api-cfn:master                "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             heat_api_cfn
24d470d878cf   kolla/ubuntu-source-heat-api:master                    "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             heat_api
9f2c5bee4cd8   kolla/ubuntu-source-neutron-metadata-agent:master      "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             neutron_metadata_agent
f261ee8e08b8   kolla/ubuntu-source-neutron-l3-agent:master            "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             neutron_l3_agent
52f2f14b69ea   kolla/ubuntu-source-neutron-dhcp-agent:master          "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             neutron_dhcp_agent
90aa8d550be5   kolla/ubuntu-source-neutron-openvswitch-agent:master   "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             neutron_openvswitch_agent
98dbb3ed88e0   kolla/ubuntu-source-neutron-server:master              "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             neutron_server
6e1055303292   kolla/ubuntu-source-openvswitch-vswitchd:master        "dumb-init --single-…"   16 hours ago   Up 16 hours                       openvswitch_vswitchd
5c8d431b6928   kolla/ubuntu-source-openvswitch-db-server:master       "dumb-init --single-…"   16 hours ago   Up 16 hours                       openvswitch_db
c84f4428c9a1   kolla/ubuntu-source-nova-novncproxy:master             "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             nova_novncproxy
62dd34fe57f8   kolla/ubuntu-source-nova-conductor:master              "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             nova_conductor
72b0aefdf986   kolla/ubuntu-source-nova-api:master                    "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             nova_api
ea06b3efab10   kolla/ubuntu-source-nova-scheduler:master              "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             nova_scheduler
8ce685d32cf0   kolla/ubuntu-source-placement-api:master               "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             placement_api
aeebb8887159   kolla/ubuntu-source-glance-api:master                  "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             glance_api
fe822dfeb19b   kolla/ubuntu-source-keystone:master                    "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             keystone
7af8407ffb86   kolla/ubuntu-source-keystone-fernet:master             "dumb-init --single-…"   16 hours ago   Up 16 hours                       keystone_fernet
0c7f448911d3   kolla/ubuntu-source-keystone-ssh:master                "dumb-init --single-…"   16 hours ago   Up 16 hours (healthy)             keystone_ssh
8847614a1c03   kolla/ubuntu-source-rabbitmq:master                    "dumb-init --single-…"   16 hours ago   Up 16 hours                       rabbitmq
75bb2170f7b3   kolla/ubuntu-source-memcached:master                   "dumb-init --single-…"   16 hours ago   Up 16 hours                       memcached
1176a6c088ba   kolla/ubuntu-source-mariadb-clustercheck:master        "dumb-init --single-…"   16 hours ago   Up 16 hours                       mariadb_clustercheck
32b1ab2ee627   kolla/ubuntu-source-mariadb-server:master              "dumb-init -- kolla_…"   16 hours ago   Up 16 hours                       mariadb
94b5a08fb7d3   kolla/ubuntu-source-keepalived:master                  "dumb-init --single-…"   16 hours ago   Up 16 hours                       keepalived
6a9268ac8b49   kolla/ubuntu-source-haproxy:master                     "dumb-init --single-…"   16 hours ago   Up 16 hours                       haproxy
f278d62513e2   kolla/ubuntu-source-chrony:master                      "dumb-init --single-…"   16 hours ago   Up 16 hours                       chrony
3e4945378daf   kolla/ubuntu-source-cron:master                        "dumb-init --single-…"   16 hours ago   Up 16 hours                       cron
da60d7dd6514   kolla/ubuntu-source-kolla-toolbox:master               "dumb-init --single-…"   16 hours ago   Up 16 hours                       kolla_toolbox
87bdb22f3f22   kolla/ubuntu-source-fluentd:master                     "dumb-init --single-…"   16 hours ago   Up 16 hours                       fluentd

Using Openstack


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

Create openrc file

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

Check

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

Check and set env

root@yjwang0-stack-01:~/kolla-ansible/tools# . /etc/kolla/admin-openrc.sh 
root@yjwang0-stack-01:~/kolla-ansible/tools# cat /etc/kolla/admin-openrc.sh 
# Clear any old environment that may conflict.
for key in $( set | awk '{FS="="}  /^OS_/ {print $1}' ); do unset $key ; done
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=D4sADozLQ5AuvhGBmzI7ZVbVI6DGu3FKzkwLLMwg
export OS_AUTH_URL=http://10.99.99.25:35357/v3
export OS_INTERFACE=internal
export OS_ENDPOINT_TYPE=internalURL
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME=RegionOne
export OS_AUTH_PLUGIN=password

[option] create example networks, images, etc

Edit Network Information

root@yjwang0-stack-01:~/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-01:~/kolla-ansible/tools# ./init-runonce

[option] bash completion

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

Open V switch 확인

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

root@yjwang0-stack-01:~# docker exec -it openvswitch_db ovs-vsctl list-ports br-int
int-br-ex
patch-tun
tapb8f2242b-17

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

root@yjwang0-stack-01:~# docker exec -it openvswitch_db ovs-vsctl list-ports br-tun
patch-int
vxlan-0a633a16
vxlan-0a633a17
반응형