GithubHelp home page GithubHelp logo

samir-saad / openshift-origin-multi-node-cluster Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 9.0 63 KB

OpenShift automated cluster of 5 machines: Vagrant, Shell, and Ansible

License: MIT License

Shell 94.38% Ruby 5.62%
vagrant openshift openshift-origin centos7 cluster ansible dns virtualbox virtual-machine advanced

openshift-origin-multi-node-cluster's Introduction

OpenShift Origin Multi-Node Cluster

An OpenShift 3.6 cluster of 5 machine:

Machine Hostname IP Description
Toolbox toolbox.ocp.local.net 10.0.1.100 Ansible, Bind DNS, and NFS storage
Master master.ocp.local.net 10.0.1.101 Cluster Master node
Infra infra.ocp.local.net 10.0.1.110 Infra Node hosting Docker registry and HA Proxy router
Node1 node1.ocp.local.net 10.0.1.111 Worker node
Node2 node2.ocp.local.net 10.0.1.112 Worker node

Hardware Requirements

This demo environment requires a machine of:

  • 4 cores
  • 16 GB RAM
  • 40 GB free disk space
Machine CPU Memory Primary Disk Secondary Disk
Toolbox 1 2048 MB 40 GB dynamic allocation NA
Master 1 3072 MB 40 GB dynamic allocation 15 GB, dynamic, for Docker storage
Infra 1 3072 MB 40 GB dynamic allocation 20 GB, dynamic, for Docker storage
Node1 1 3072 MB 40 GB dynamic allocation 20 GB, dynamic, for Docker storage
Node2 1 3072 MB 40 GB dynamic allocation 20 GB, dynamic, for Docker storage

Note: If your machine has 8 GB RAM you can do the following:

1. Edit the machines-config.yml:

  • Remove node2 at the end of the file.
  • Adjust machines memory to be:
Machine Memory
Toolbox 512 MB
Master 2048 MB
Infra 2048 MB
Node1 2048 MB

2. Edit /ansible/ansible-hosts.yaml: remove node2 from [worker_nodes] group.

Prerequisites

The following steps are tested on a Windows host machine.

Install VirtualBox

Install Vagrant

  • Install Vagrant. This environment has been tested with Vagrant 1.9.7

  • Install Vagrant VirtualBox Guest Plugin

vagrant plugin install vagrant-vbguest

Network

All the machines are configures with NAT and Host Only adapters.

Note: The network may not behave properly over VPN, please disable any VPN before running the cluster.

Cluster Provisioning

  • Clone or download this repository to your host machine.

Recommendation: It's recommended to change the SSK keys under keys directory.

  • Navigate to your local copy and run the following command
cluster init [parallel]

Note: The command will start the machines in the following order:

  1. master, infra, node1, and node2
  2. toolbox

Note: The second argument 'parallel' is optional. It directs vagrant to start machines in parallel when possible.

Note: As it's the first run of the machines, Vagrant will run provisioning scripts to install any required tools and configure the machines connectivity and networking.

Connecting to The Cluster

Test Network Connectivity

Firstly, try to ping the cluster machines from your host:

ping 10.0.1.100
ping 10.0.1.101
ping 10.0.1.110
ping 10.0.1.111
ping 10.0.1.112

Add Cluster DNS to Host Machine

Now, we need to cluster DNS to host in order to resolve machines hostnames:

  • Go to Network Connections
  • Select the VirtualBox Host-Only Network --> Properties --> Internet Protocol version 4 --> Properties
  • Make sure that the IP addressis 10.0.1.1, otherwise, try another adapter.
  • Add DNS server 10.0.1.100 and save.
  • Try to ping using machine hostname:
ping toolbox.ocp.local.net
  • Test the wildcard DNS:
ping XYZ.cloudapps.ocp.local.net

SSH Connection to Cluster Machines

Use your preferred SSH Client to connect to the machines. I personally recommend MobaXterm. Use the private key in the /keys directory to connect. Machines Users:

User Password
root vagrant
vagrant vagrant

Installation and Configuration

Recommendation: I recommend that you take snapshots of the machines at this point, so you call roll back to them.

Connect to the Toolbox machine, and make sure that Ansible can reach to all the cluster machines:

ansible cluster -m ping

Docker

  • Install Docker and configure its storage:
ansible-playbook /vagrant/ansible/playbooks/setup-docker.yml
  • Pull Docker images prior to OpenShift installation:
ansible-playbook /vagrant/ansible/playbooks/populate-docker-registry.yml

Recommendation: Take snapshots of machines: master, infra, node1, and node1.

OpenShift

  • Install OpenShift Prerequisites:
ansible-playbook /vagrant/ansible/playbooks/openshift-pre-install.yml
  • Install OpenShift:
ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml
  • Configure OpenShift:
ansible-playbook /vagrant/ansible/playbooks/openshift-post-install.yml

Cluster Control

  • Start the Cluster:
cluster up [parallel]
  • Shutdown the Cluster:
cluster down

Next Enhancements

  • Enhance documentation.
  • Convert provisioning shell scripts to Ansible playbooks.
  • Use GlusterFs for storage.

openshift-origin-multi-node-cluster's People

Contributors

samir-saad avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.