Deploying Highly Available Openshift Origin Clusters With Ansible

in #utopian-io7 years ago (edited)

OpenShift is a prevalent new Platform-As-A-Service application facilitating stage. It's moderately convoluted to convey, yet in the accompanying post you will discover how to rapidly and effortlessly send a generation prepared OpenShift bunch on-start or in the AWS EC2 cloud utilizing Ansible.

A Primer into OpenShift Architecture

OpenShift Overview

OpenShift Origin is the cutting edge application facilitating stage which empowers the clients to make, send and oversee applications inside their cloud. As such, it gives a PaaS benefit (Platform as a Service). This lightens the designers from tedious procedures like machine provisioning and important application arrangements. OpenShift gives circle space, CPU assets, memory, arrange availability, and different application organization stages like JBoss, Python, MySQL, and so on., so the designers can invest their energy in coding and testing new applications as opposed to investing time making sense of how to secure and design these assets.

OpenShift Components

Here's a rundown and a short diagram of the diverse parts utilized by OpenShift.

  • Broker: is the single purpose of contact for all application administration exercises. It is in charge of overseeing client logins, DNS, application state, and general coordination of the application. Clients don't contact the intermediary specifically; rather they utilize the Web reassure, CLI devices, or JBoss apparatuses to connect with Broker over a REST-based API.

  • Cartridges: give the genuine usefulness important to run the client application. OpenShift presently bolsters numerous dialect Cartridges like JBoss, PHP, Ruby, and so forth., and additionally numerous database Cartridges, for example, Postgres, MySQL, MongoDB, and so on. On the off chance that a client need to convey or make a PHP application with MySQL as a backend, they can simply request that the specialist send a PHP and a MySQL cartridge on partitioned "Apparatuses".

  • Gear: Gears give an asset compelled holder to run at least one Cartridges. They restrict the measure of RAM and plate space accessible to a Cartridge. For straightforwardness we can consider this as a different VM or Linux compartment for running an application for a particular inhabitant, yet in actuality they are holders made by SELinux settings and PAM namespacing.

  • Node: are the physical machines where Gears are dispensed. Apparatuses are for the most part finished allotted on hubs since not all applications are dynamic in the meantime.

  • BSN (Broker Support Nodes): are the hubs which run applications for OpenShift administration. For instance, OpenShift utilizes MongoDB to store different client/application subtle elements, and it likewise utilizes ActiveMQ to speak with various application hubs by means of MCollective. The hubs which have these supporting applications are called as Broker Support Nodes.

  • Districts: are asset pools which can be utilized to isolate the application hubs in light of execution or situations. For instance, in a generation organization we can have two Districts of Nodes, one of which has assets with bring down memory/CPU/circle necessities, and another for elite applications.

The Application Creation Process

ansi.jpg

The above figure portrays a review of the distinctive advances associated with making an application in OpenShift. In the event that an engineer needs to make or convey a JBoss and MySQL application, they can ask for the same from various customer devices that are accessible, the decision can be an Eclipse IDE , summon line apparatus (RHC) or even a web program (administration comfort).

Once the client has educated the customer apparatus to convey a JBoss and MySQL application, the customer device influences a web to benefit demand to the dealer to arrangement the assets. The dealer thus questions the Nodes for Gear and Cartridge accessibility, and if the assets are accessible, two Gears are made and JBoss and MySQL Cartridges are conveyed on them. The client is then informed and they would then be able to get to the Gears by means of SSH and begin conveying the code.

Sending Diagram of OpenShift through Ansible

ansi 2.jpg

The above outline demonstrates the Ansible playbooks sending a very accessible Openshift PaaS condition. The organization has two servers running LVS (Piranha) for stack adjusting and gives HA to the Brokers. Two occasions of Brokers likewise keep running for adaptation to non-critical failure. Ansible likewise designs a DNS server which gives name determination to all the new applications made in the OpenShift condition.

Three BSN (Broker Support Node) hubs give an imitated MongoDB organization and similar hubs run three occurrences of an exceptionally accessible ActiveMQ bunch. There is no constraint on the quantity of utilization hubs you can deploy– the client simply needs to include the hostnames of the OpenShift hubs to the Ansible stock and Ansible will design every one of them.

Note: As a best practice if the organization is in a real generation condition it is prescribed to incorporate with the framework's inner DNS server for name determination and utilize LDAP or coordinate with a current Active Directory for client validation.

Arrangement Steps for OpenShift through Ansible

As an initial step we have to set up a host with Ansible.

Accepting the Ansible host is RHEL variation, introduce the EPEL bundle


yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Once the EPEL archive is introduced, Ansible can be introduced by means of the accompanying summon.


yum install ansible

It is prescribed to utilize isolate machines for the diverse segments of OpenShift, however in the event that this is a test domain, we could join the administrations yet no less than four hubs are required since the MongoDB and ActiveMQ bunch require no less than three for the group to work legitimately.

Once Ansible is set up, look at OpenShift playbook vault from GitHub to the Ansible administration have:


git clone https://github.com/ansible/ansible-examples.git

Set up the host stock as takes after.


 [dns]
      ec2-54-226-116-175.compute-1.amazonaws.com

[mongo_servers]
      ec2-54-226-116-175.compute-1.amazonaws.com
      ec2-54-227-131-56.compute-1.amazonaws.com
      ec2-54-227-169-137.compute-1.amazonaws.com

[mq]
      ec2-54-226-116-175.compute-1.amazonaws.com
      ec2-54-227-131-56.compute-1.amazonaws.com
      ec2-54-227-169-137.compute-1.amazonaws.com

[broker]
      ec2-54-227-63-48.compute-1.amazonaws.com
      ec2-54-227-171-2.compute-1.amazonaws.com

[nodes]
      ec2-54-227-146-187.compute-1.amazonaws.com

 [lvs]
     ec2-54-227-176-123.compute-1.amazonaws.com
     ec2-54-227-177-87.compute-1.amazonaws.com

Once the stock is set up with has in your condition, the OpenShift stack can be sent effectively by issuing the accompanying summon:


ansible-playbook -i hosts site.yml

Sending an Application in OpenShift

To make an application in OpenShift, get to the administration support by means of any program. The VIP indicated in group_vars/all can used to get to the Management Console, or IP address of any dealer hub can likewise be utilized.

https://<ip-of-intermediary or-vip>/

The login page will incite for a username and secret key. The default is "demo/passme". When you are signed in, take after the onscreen guidelines to make your first Application.

Note: the Python 2.6 Cartridge is as a matter of course introduced by the playbooks, so pick Python 2.6 as the Cartridge.

Conveying OpenShift in EC2

The Ansible OpenShift repo additionally has playbook that would send exceptionally accessible OpenShift in EC2. The playbooks are likewise ready to convey the bunch in any EC2 API-perfect mists like Eucalyptus.

Before sending to EC2, please ensure:

  • A security bunches is made which permits ssh and HTTP/HTTPS activity.

  • Your AWS get to/mystery enter is entered in group_vars/all

  • Indicate the quantity of hubs required for the bunch in group_vars/all in the variable "tally".

Once that is done, the group can be conveyed essentially by issuing the summon.


ansible-playbook -i ec2hosts ec2.yml -e id=openshift

Note: 'id' is a one of a kind identifier for the bunch. On the off chance that you are conveying numerous groups, please ensure the esteem given is separate for every organization. The part of the made cases can made sense of checking the labels tab in EC2 reassure.

Expelling the Deployed Cluster from EC2

To expel the conveyed OpenShift group in EC2, simply run the accompanying charge. The id parameter ought to be a similar which was given to make the group.


ansible-playbook -i ec2hosts ec2_remove.yml -e id=openshift

We trust this blog entry was helpful and useful! We are constantly inspired by your input so please send us an email at [email protected] in the event that you have any inquiries, recommendations, or remarks!



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved yet. See the Utopian Rules. Please edit your contribution to reapply for approval.


The image credits are missing. Where do the images come from?


You may edit your post here, as shown below:

You can contact us on Discord.
[utopian-moderator]

Your contribution cannot be approved because it does not follow the Utopian Rules, and is considered as plagiarism. Plagiarism is not allowed on Utopian, and posts that engage in plagiarism will be flagged and hidden forever.

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 57958.96
ETH 2283.65
USDT 1.00
SBD 2.46