📜 ⬆️ ⬇️

We start application in Openshift and we compare the existing toolkit

This is fine


I want to tell the story of how the application was launched in Openshift. Also in the course of the play we will consider utilities for managing the application inside Openshift. This is a transcript of a performance on kubernetes SPB meetup # 3 ..


purpose


Typically, customers deploy on separate servers, but then came the task, to test the possibility of running openshift and picking rake.


First you need to talk about our application. A project with a rich history. Used in large organizations and probably each of you indirectly intersected. The application supports multiple databases, integrations, etc. etc.


Prerequisites


Deploy


The application should work in completely different environments. As a result, our installation documentation is quite extensive. But if you look down, then nothing complicated:



Deploy


But the world is cruel, we had a number of restrictions:



Ansible container demo


Ansible container


Ansible container is open source software that aims to automate container assembly, deployment, and process control. As you might guess from the name. Ansible is used to build containers. We already had written Ansible roles for installing and deploying applications on top of servers, so we decided not to reinvent the wheel and reuse them. Not that this is an ideal tool, but a quick re-use of existing roles has proven to be a decisive factor for the demo.


By and large, in order to make a demo we took the existing roles that set up everything and everyone, and made a "monolithic container". What to collect the container there were no special problems, because Openshift has some great recommendations , but I ’ll note separately:



The main idea at this point is that we made the demo sooo fast.


Multiple containers demo


Multiple containers


The demo container fulfilled its role and we sawed it into separate components:


  1. Our application.
  2. Database.
  3. External services, etc ...

Multiple containers


The first thing that faced, how to initialize the database? It is clear that we use migrations, but when and how to apply them? There is a link to a wonderful article describing the device POD: PODs life . By and large, there are several approaches:



We decided to take the Init-container path. Those. in the POD of our application, before the start of our application, the container that rolls the migration starts. But how to configure the application itself and external integrations?


Initialize the application


Multiple containers


As I already mentioned, our application can and should work perfectly in different environments, with different databases and integrations. Again, the question is how to set it all up?



We chose the latter approach, because It allows you to make the configuration reproducible and self-sufficient. Only for some reason, this container was originally made in a separate replication controller with a factor of 1.


Multiple containers


Ok, read the documentation again.


A pod (as in a pod of whales or pea pod) is a group of containers (such as Docker containers),

POD is a group of containers. As a result, our sub consisted of 3 containers.


  1. Init container to initialize a PostgreSQL.
  2. Container with an app.
  3. Container configuration application.

Tools


We have a scheme of how the application is deployed. Now it’s time to discuss the tools in nature; there are a lot of things already done, I’ll look at some of the list below and make subjective conclusions.



Openshift templates


Openshift templates


Openshift templates


Pros:



Minuses:



Scripts and template


Custom scripts


Pros:



Minuses:



Terraform k8s provider


Terraform k8s provider


Terraform k8s provider


Pros:



Minuses:



Ansible container


Ansible container


Ansible container


Pros:



Minuses:



Ansible k8s module


Ansible k8s module


Ansible + k8s module


Pros:



Minuses:



Ansible Playbook Bundle


Ansible Playbook Bundle


The Ansible Playbook Bundle (APB) utility offers an approach: let's package the ansible roles for deploying the application inside k8s / openshift into a container and run inside k8s / openshift.


Pros:



Minuses:



Result


Result


I do not want to be the last instance, but I will share my conclusions:



PS



')

Source: https://habr.com/ru/post/441928/


All Articles