PageRenderTime 55ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/openstack/kolla_archlinux_notes.org

https://gitlab.com/gojun077/junsTechNotes
Org | 254 lines | 196 code | 58 blank | 0 comment | 14 complexity | d01becae94c1d9d595647a22b4ad79b6 MD5 | raw file
  1. * OVERVIEW
  2. Project Kolla uses Ansible scripts and Python 2 to build an
  3. Openstack cloud using Docker containers for each infrastructure
  4. component. Setting up Kolla on Archlinux requires some tweaks
  5. because the default 'python' binary is Python 3 instead of Python
  6. 2, the latter of which is required to run Ansible.
  7. Before you start, make sure you have 40G+ space left in /var
  8. because 40G will be taken up by /var/lib/docker to build all
  9. the necessary containers! If you don't have enough space under
  10. /var you will need to specify another path for docker to use
  11. for storing containers and images.
  12. https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169
  13. ** Install Project Kolla and tools
  14. The git repo contains Kolla tools, but to install Kolla cmds
  15. to system directories /usr/bin, you need to install kolla from
  16. pip2
  17. Archlinux includes the latest versions of docker from its default
  18. repos, so just make sure docker is installed locally (if not,
  19. simply 'pacman -S docker').
  20. 'pip' for python 2 must also be installed (python2-pip)
  21. Unlike the instructions from
  22. http://docs.openstack.org/developer/kolla/quickstart.html
  23. http://docs.openstack.org/developer/kolla/dev-quickstart.html
  24. make sure to replace /pip/ with /pip2/ for Archlinux!
  25. #+BEGIN_SRC shell
  26. git clone https://git.openstack.org/openstack/kolla
  27. cd kolla
  28. sudo pip2 install -r requirements.txt
  29. #sudo pip2 install kolla
  30. #sudo cp -r etc/kolla /etc/
  31. sudo pip2 install -U python-openstackclient
  32. #+END_SRC
  33. Don't install the python2 pip package 'kolla'! It installs similar
  34. files to the ones installed by git clone, but the former installs
  35. files under /usr/share/kolla/...
  36. Instead of running commands from pip2 kolla package, I will run fresh
  37. commands from $HOME/kolla (the kolla git repo which was cloned above)
  38. Make sure you have chronyd or ntpd setup on localhost
  39. If not, install the package for one or the other and
  40. systemctl enable ... and systemctl start ...
  41. ** Customizations for Arch
  42. 1. *Specify location of Python 2 binary*
  43. edit the ansible /inventory/ file (not /etc/ansible/ansible.cfg):
  44. #+BEGIN_SRC shell
  45. #sudo vim /usr/share/kolla/ansible/inventory/all-in-one
  46. vim $HOME/kolla/ansible/inventory/all-in-one
  47. #+END_SRC
  48. And add the following somewhere in the file
  49. #+BEGIN_SRC shell
  50. localhost ansible_python_interpreter=/usr/bin/python2
  51. #+END_SRC
  52. 2. *Install graphviz dependency for python 2 graphviz module from pip2*
  53. https://pypi.python.org/pypi/graphviz
  54. From the pip page,
  55. "This package facilitates the creation and rendering of graph
  56. descriptions in the DOT language of the Graphviz graph drawing
  57. software"
  58. I tried to find a native Arch package for python2 module graphviz
  59. but only came up with the following:
  60. #+BEGIN_SRC shell
  61. $ sudo pacman -Ss graphviz
  62. extra/graphviz 2.38.0-11
  63. Graph visualization software
  64. community/dot2tex 2.9.0-1
  65. Graphviz to LaTeX converter
  66. community/perl-graphviz 2.20-1
  67. GraphViz - Interface to AT&T's GraphViz. Deprecated. See GraphViz2
  68. community/python2-pydot 1.0.28-3
  69. Python interface to Graphviz's Dot language
  70. community/xdot 0.6-4
  71. Interactive viewer for graphs written in Graphviz's dot language
  72. #+END_SRC
  73. 'graphviz' (a program written in C) is a dependency of python2 graphviz,
  74. so make sure to install it
  75. #+BEGIN_SRC shell
  76. sudo pacman -Syyu graphviz
  77. #+END_SRC
  78. python2 graphviz should have already been installed by pip2 when you
  79. invoked 'sudo pip2 install -r requirements.txt' from the kolla
  80. directory
  81. ** Build docker containers
  82. - Disable libvirtd
  83. Before you begin, make sure that libvirtd daemon is not running!
  84. #+BEGIN_SRC shell
  85. systemctl status libvirtd
  86. #+END_SRC
  87. Stop and disable if libvirtd is running
  88. - Disable firewalld
  89. docker daemon tries to append iptables rules, but these fail in
  90. firewalld. After stopping firewalld, restart the docker daemon
  91. #+BEGIN_SRC shell
  92. systemctl stop firewalld
  93. systemctl restart docker
  94. #+END_SRC
  95. - Build Kolla containers (using commands from cloned repo)
  96. #+BEGIN_SRC shell
  97. cd $HOME/kolla/tools
  98. python2 build.py --base [centos|fedora|ubuntu|oraclelinux]
  99. #+END_SRC
  100. You can also specify a single package with something like:
  101. #+BEGIN_SRC shell
  102. cd $HOME/kolla/tools
  103. python2 build.py openstack-base --base ubuntu
  104. #+END_SRC
  105. *Avoid using /kolla-build/ from the kolla pip package!*
  106. The problem is that this package is not as frequently updated
  107. as the git repo! I installed kolla-build and related prog's
  108. from the 'kolla' package from pip2; check the system logs to
  109. be sure...
  110. The nice thing about the ubuntu containers is that they include iproute2
  111. and other utilities that make container debugging convenient, unlike
  112. centos
  113. + Alternative method (not recommended)
  114. from pip2 kolla pkg:
  115. #+BEGIN_SRC shell
  116. kolla-build --base [centos|fedora|ubuntu|oraclelinux]
  117. #+END_SRC
  118. ** Customize globals.yaml
  119. /etc/kolla/globals.yaml contains the global config for Kolla
  120. - Internal Network Interface
  121. default is 'eth0' but I changed to 'enp1s0' as the only wired
  122. iface on the Lenovo S310
  123. - External Network Interface
  124. There is a wirless iface on wlp2s0 but it cannot be directly
  125. connected to a bridge. The default in globals.yaml is 'eth1'
  126. but I changed this value to point to one end of a virtual
  127. ethernet iface I created
  128. ** Start Kolla
  129. Running 'kolla-ansible' without any arguments will return a command
  130. reference
  131. ** Errors
  132. + Network connectivity issues due to firewalld running
  133. INFO:__main__:base:Step 9 : RUN yum -y install http://repo.percona.com/release/7/RPMS/x86_64/percona-release-0.1-3.noarch.rpm
  134. INFO:__main__:base: ---> Running in 105c3cc123ca
  135. INFO:__main__:base:Loaded plugins: fastestmirror, ovl
  136. INFO:__main__:base:Cannot open: http://repo.percona.com/release/7/RPMS/x86_64/percona-release-0.1-3.noarch.rpm. Skipping.
  137. A clone of the centos7 container fails to yum install a
  138. package. After the container builds failed I checked the existing
  139. images with 'docker images'
  140. [archjun@pinkS310 tools]$ docker images
  141. REPOSITORY TAG IMAGE ID CREATED SIZE
  142. <none> <none> aec129e7e87d 5 minutes ago 196.6 MB
  143. busybox latest 0cb40641836c 4 weeks ago 1.114 MB
  144. centos latest 61b442687d68 7 weeks ago 196.6 MB
  145. I then got a shell into the image with:
  146. #+BEGIN_SRC shell
  147. docker run -it aec129e7e87d
  148. #+END_SRC
  149. I verified that ping 8.8.8.8 works but that DNS resolution
  150. is not working at all despite /etc/resolv.conf containing KT's
  151. name servers
  152. *NOTE*: the problem turns out to be firewalld; docker attempts
  153. to insert iptables rules, but these fail in firewalld; until I
  154. figure out the proper settings for docker0 in firewalld, just
  155. disable it when running Kolla
  156. Finally I checked the existing containers
  157. [archjun@pinkS310 ~]$ docker ps -a
  158. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  159. b340327be74a aec129e7e87d "/bin/bash" 17 minutes ago Up 17 minutes jovial_wing
  160. I then deleted all images and containers (except the busybox one).
  161. With some googling, I learned that recently centos7 base
  162. container image removed common utils like iproute2
  163. which makes network troubleshooting very difficult.
  164. https://github.com/CentOS/sig-cloud-instance-images/issues/40
  165. Using 'kolla-build --base' option you can choose the distro type
  166. in the containers being built (this is not possible if you simply
  167. run build.py)
  168. #+BEGIN_SRC shell
  169. kolla-build --base fedora
  170. #+END_SRC
  171. + Error in 'kolla-build --base ubuntu' openstack-base container
  172. INFO:kolla.cmd.build:openstack-base:Step 6 : RUN patch -d /usr/lib/python2.7/site-packages -p1 < /var/lib/kolla/oslo-log-bug1499620.patch
  173. INFO:kolla.cmd.build:openstack-base: ---> Running in 1996635b6ea6
  174. INFO:kolla.cmd.build:openstack-base:patching file oslo_log/log.py
  175. INFO:kolla.cmd.build:openstack-base:Reversed (or previously applied) patch detected! Assume -R? [n]
  176. INFO:kolla.cmd.build:openstack-base:Apply anyway? [n]
  177. INFO:kolla.cmd.build:openstack-base:Skipping patch.
  178. INFO:kolla.cmd.build:openstack-base:1 out of 1 hunk ignored -- saving rejects to file oslo_log/log.py.rej
  179. INFO:kolla.cmd.build:openstack-base:Removing intermediate container 1996635b6ea6
  180. ERROR:kolla.cmd.build:openstack-base:Error'd with the following message
  181. ERROR:kolla.cmd.build:openstack-base:The command '/bin/sh -c patch -d /usr/lib/python2.7/site-packages -p1 < /var/lib/kolla/oslo-log-bug1499620.patch' returned a non-zero code: 1
  182. When the patch fails, all the subsequent container builds fail as well
  183. as they all depend on container 'openstack-base'
  184. I will try editing kolla/docker/openstack-base/Dockerfile.j2 and
  185. commenting out this line; patch is not contained in this file!
  186. + After git pull and updating repos, I verified that the erroneous patch is
  187. no longer showing up in openstack-base/Dockerfile.j2; but when I run
  188. kolla-build --base ubuntu, the old patch is still trying to be applied!
  189. I suspected that there was another openstack-base/Dockerfile.j2 somewhere
  190. on my system, and sure enough, I found it with:
  191. #+BEGIN_SRC shell
  192. sudo find / -type d -name openstack-base
  193. #+END_SRC
  194. returns the following two paths:
  195. /home/archjun/kolla/docker/openstack-base
  196. /usr/share/kolla/docker/openstack-base