Kolla ansible deploy openstack all in one (single node)

Kolla overview:

Kolla is a project for automated deployment under OpenStack. It is implemented based on docker and ansible. Docker is mainly responsible for image production and container management, and ansible is mainly responsible for environment deployment and management. Kolla is actually divided into two parts: the kolla part provides a production environment level image, covering various services used by OpenStack; The kolla ansible section provides automated deployment. At the beginning, these two parts are in a project (i.e. kolla). OpenStack has been separated from the version beginning with O. only then can there be a kolla project for building all service images and kolla ansible for automatic deployment.

Environment configuration:

Minimum server configuration:

2 network interfaces
8GB main memory
40GB disk space

Centos 8.2

preparation:

Install basic system tools;

yum -y install net-tools vim wget bash-completion lrzsz 

Turn off Slinux and firewall

setenforce 0 
vim /etc/selinux/config
 take SELINUX=enforcing Change to SELINUX=disabled
systemctl stop firewalld && systemctl disable firewalld && systemctl status firewalld

Modify hosts

vim /etc/hosts
192.168.6.35 node1

Network card configuration information

ip address

network card

Network type

explain

192.168.6.35

eno16780032

bridge

Openstack internal management network and Horizon web interface access;

None (address configuration is not required, and the network card needs to be turned on)

eno33559296

bridge

External network is used by BR ex binding of neutron (network component in Openstack). The virtual machine in Openstack communicates with the external network through this network card.

Configure alicloud source

yum clean all
yum makecache
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all

Installation dependency:

yum -y install python-devel libffi-devel gcc openssl-devel git python-pip
 to configure pip Mirror source
 mkdir .pip
 tee .pip/pip.conf << EOF 
> [global]
> index-url=http://mirrors.aliyun.com/pypi/simple/
> [install]
> trusted-host=mirrors.aliyun.com
> EOF 
 pip install -U pip #Upgrade pip to the latest version. If an error is reported

Deploy kolla ansible
1) Deploy

pip install ansible    #Deploy Ansible note: Ansible should be greater than version 2.6
pip install kolla-ansible  #Installing kolla ansible using pip

2) Copy the relevant configuration files of kolla ansible

 cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/
 cp /usr/share/kolla-ansible/ansible/inventory/* /etc/kolla/
 [root@node1 ~]# ls /etc/kolla/
 all-in-one  globals.yml  multinode  passwords.yml

File Description: all in one is an ansible automatic installation configuration file for installing single node OpenStack; multinode is an ansible automatic installation configuration file for installing multi node OpenStack; globals.yml is a custom configuration file for OpenStack deployment; passwords.yml is the password file of each service in OpenStack.

2) Edit the configuration file of kolla ansible, which is used to customize the installation of OpenStack, generate the password file of each service of OpenStack, and modify the login password of the Web page.

kolla-genpwd
vim /etc/kolla/passwords.yml
//Change line 165, which is the password to log in to the Dashboard (web interface console). Under normal circumstances, it can not be too simple. You can intercept an automatically generated password
keystone_admin_password: hsh.2019#

Edit / etc / kolla / global YML customize deployment matters in OpenStack

vim /etc/kolla/globals.yml
//In lines 14 and 15, select the downloaded basic image and choose 1 from 5
# Valid options are ['centos', 'debian', 'oraclelinux', 'rhel', 'ubuntu']
kolla_base_distro: "centos"
 
//Lines 17 and 18, select the installation method, 1 out of 2. binary installation, source source installation
# Valid options are [ binary, source ]
kolla_install_type: "source"
 
//In lines 20 and 21, select the version label of OpenStack. For details, see: https://releases.openstack.org/
# Valid option is Docker repository tag
openstack_release: "stein"  //Note that the version must be lowercase, and the docker image label related to OpenStack downloaded later is also stein. I changed to stein because the train version failed
 
//Lines 23 and 24, where to store the configuration file
# Location of configuration overrides
#node_custom_config: "/etc/kolla/config" / / default storage address
 
//Line 31, OpenStack internal management network address, and access OpenStack Web page for management through this IP. If high availability is enabled, it needs to be set to VIP (drift IP)
kolla_internal_vip_address: "192.168.128.240"
 
//Line 87, the network card interface of OpenStack internal management network address
network_interface: "ens32"
 
//In line 105, the network card interface of OpenStack external (or public) network can be vlan mode or flat mode.
//This network card should be active without an IP address. If not, the virtual machine instance in the OpenStack cloud platform will not be able to access the external network. (when IP exists, br-ex bridging is not successful)
neutron_external_interface: "ens33"
 
//Line 190, turn off high availability
enable_haproxy: "no"
 
//Line 213, turn off the cinder
#enable_cinder: "no"
 
//Lines 443 and 444 specify the virtualization technology used by the nova compute daemon. (there seems to be a problem with kvm. You can try it and see if you can download it via nova)
//Nova compute is a very important daemon, which is responsible for creating and terminating virtual machine instances, that is, managing the life cycle of virtual machine instances
# Valid options are [ qemu, kvm, vmware, xenapi ]
nova_compute_virt_type: "qemu"        #I chose KVM

4, Installing OpenStack private cloud based on kolla ansible

Configure the / etc / kolla / all in one file

//Modify lines 3 to 19 and change "localhost; ansible_connection=local" to "node1"

//You can use the replacement command: ":% s/localhost; ansible_connection=local/node1/g"

[root@node1 ~]# head -20 /etc/kolla/all-in-one 
# These initial groups are the only groups required to be modified. The
# additional groups are for more control of the environment.
[control]
node1
[network]
node1
[compute]
node1
[storage]
node1
[monitoring]
node1
[deployment]
node1
# You can explicitly specify which hosts run each project by updating the
# groups in the sections below. Common services are grouped together.
[chrony-server:children]
haproxy

[chrony:children]

Start deploying OpenStack. Note: when I use Alibaba cloud's epel source, I get stuck in the task [baremetal: install Yum packages] step when installing bootstrap server. The epel source installed in the system only waited about 5 minutes.

//Install the dependent packages required by bootstrap servers to deploy OpenStack. This package is provided by kolla ansible and contains docker.

kolla-ansible -i /etc/kolla/all-in-one bootstrap-servers


 //Pre deploy (detect) the current host and directly look at the final statistics. If an error is detected, you can view the previous TASK:[precheck...] Part, you can quickly locate the error


 kolla-ansible -i /etc/kolla/all-in-one prechecks


 //View docker volume mount method


 vim /etc/systemd/system/docker.service.d/kolla.conf
[Service]
MountFlags=shared  //Add this line. When the docker host adds partitions later, the docker service does not need to be restarted to facilitate the host to add disks.
ExecStart=
ExecStart=/usr/bin/dockerd --log-opt max-file=5 --log-opt max-size=50m
//Specify a docker accelerator and Alibaba cloud can apply for it for free
tee /etc/docker/daemon.json << 'EOF'
{
  "registry-mirrors": ["https://fxa4g5lx.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
kolla-ansible -i /etc/kolla/all-in-one pull   #It takes 2-3 hours to remove the image;
//Install the dependent packages required by bootstrap servers to deploy OpenStack. This package is provided by kolla ansible and contains docker.
 kolla-ansible -i /etc/kolla/all-in-one bootstrap-servers
 //Pre deploy (detect) the current host and directly look at the final statistics. If an error is detected, you can view the previous TASK:[precheck...] Part, you can quickly locate the error
 kolla-ansible -i /etc/kolla/all-in-one prechecks
 //View docker volume mount method
 vim /etc/systemd/system/docker.service.d/kolla.conf
[Service]
MountFlags=shared  //Add this line. When the docker host adds partitions later, the docker service does not need to be restarted to facilitate the host to add disks.
ExecStart=
ExecStart=/usr/bin/dockerd --log-opt max-file=5 --log-opt max-size=50m
//Specify a docker accelerator and Alibaba cloud can apply for it for free
tee /etc/docker/daemon.json << 'EOF'
{
  "registry-mirrors": ["https://fxa4g5lx.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
kolla-ansible -i /etc/kolla/all-in-one pull   #It takes 2-3 hours to remove the image;
[root@node1 ~]# docker image list
REPOSITORY                                      TAG                 IMAGE ID            CREATED             SIZE
kolla/centos-source-nova-compute                stein               29a1089c3439        12 days ago         1.86GB
kolla/centos-source-horizon                     stein               528ec4d61425        12 days ago         1.05GB
kolla/centos-source-nova-ssh                    stein               0206e811f97b        12 days ago         1.07GB
kolla/centos-source-heat-api                    stein               15697345e54b        12 days ago         906MB
kolla/centos-source-heat-api-cfn                stein               d7109464a5ac        12 days ago         906MB
kolla/centos-source-heat-engine                 stein               a53b323f6d89        12 days ago         906MB
kolla/centos-source-nova-consoleauth            stein               0218807c7f25        12 days ago         1.04GB
kolla/centos-source-nova-api                    stein               0821f9feba2e        12 days ago         1.1GB
kolla/centos-source-nova-novncproxy             stein               a58340553002        12 days ago         1.07GB
kolla/centos-source-placement-api               stein               eed6f0a74817        12 days ago         932MB
kolla/centos-source-nova-conductor              stein               2592000fbc39        12 days ago         1.04GB
kolla/centos-source-nova-scheduler              stein               628404562a7d        12 days ago         1.04GB
kolla/centos-source-neutron-server              stein               a99220d46d30        12 days ago         1.05GB
kolla/centos-source-neutron-l3-agent            stein               9b76ae64d561        12 days ago         1.06GB
kolla/centos-source-neutron-metadata-agent      stein               813dcf95e9cc        12 days ago         1.02GB
kolla/centos-source-neutron-openvswitch-agent   stein               fd258779b5c7        12 days ago         1.02GB
kolla/centos-source-neutron-dhcp-agent          stein               fb5df664eff0        12 days ago         1.02GB
kolla/centos-source-glance-api                  stein               b2ebb8704be4        12 days ago         922MB
kolla/centos-source-keystone-fernet             stein               0b8d0abcb18e        12 days ago         932MB
kolla/centos-source-keystone-ssh                stein               925d5ac5df29        12 days ago         933MB
kolla/centos-source-keystone                    stein               3dafc7bd16db        12 days ago         932MB
kolla/centos-source-openvswitch-vswitchd        stein               c93f857f8cb2        12 days ago         424MB
kolla/centos-source-openvswitch-db-server       stein               8bf18465403a        12 days ago         424MB
kolla/centos-source-nova-libvirt                stein               ff0278b83bfc        12 days ago         1.21GB
kolla/centos-source-kolla-toolbox               stein               43a3d49dedf8        12 days ago         698MB
kolla/centos-source-cron                        stein               9798d8d56c7f        12 days ago         406MB
kolla/centos-source-rabbitmq                    stein               f4004eec41a4        12 days ago         486MB
kolla/centos-source-fluentd                     stein               deac0e6e1726        12 days ago         540MB
kolla/centos-source-chrony                      stein               3ece76e19e9f        12 days ago         407MB
kolla/centos-source-mariadb                     stein               1ec2dfae2f33        12 days ago         594MB
kolla/centos-source-memcached                   stein               46c37f70347c        12 days ago         407MB

Deploy Openstack

kolla-ansible -i /etc/kolla/all-in-one deploy
//Verify the deployment and generate / etc / kolla / Admin openrc. Exe sh
kolla-ansible -i /etc/kolla/all-in-one post-deploy



kolla-ansible -i /etc/kolla/all-in-one post-deploy  -vvv #Details can be printed;
[root@node1 ~]# cat /etc/kolla/admin-openrc.sh 
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=hsh.2019#      //#The account password of the web login interface admin HSH 2019#
export OS_AUTH_URL=http://192.168.6.35:35357/v3
export OS_INTERFACE=internal
export OS_IDENTITY_API_VERSION=3
export OS_REGION_NAME=RegionOne
export OS_AUTH_PLUGIN=password

Error 1: failed to pull the image.

First, repeat the pull image operation several times. If it still fails, check / etc / kolla / global Whether the version number on line 21 in YML is correct. If the version number is correct, an error is still reported when you pull the image again, then go back one version and try to pull the image. (I just can't use the train version. Return to the stein version or use the queens version) pay attention to cleaning up the images of other versions

Access after deployment: http://192.168.6.35/

#Unload clean cache kolla ansible destroy/ all-in-one --yes-i-really-really-mean-it

You can clean up the installed openstack

Reference address: https://docs.openstack.org/project-deploy-guide/kolla-ansible/train/quickstart.html#install-kolla-ansible

Tags: Virtualization

Posted by kumarsatishn on Wed, 19 Jan 2022 21:08:21 +1030