31.10.17

Install openshift quickly when things are on fire

We're in a firedrill.

I put together this script to deal with the fact that we may want to test several different openshift versions quickly,

- minishift - is great but you cant run it in the cloud.
- openshift-ansible is nice to, but you need cloud infra to support it.
- tools like origin-aws-terraform are promising, butin our experience, they dont support multiple accounts easily.

So, Here goes:  The following will, (almost) get a openshift origin cluster up and running.  There may be a few kinks, it should cover about 75% of what you need, in any case.

Note: This may not work with all tags - on centos 7.4, i keep hitting a very odd error around iptables rules 
yum update -y
function setup {
        sudo yum install -y tmux git ; sudo yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo ; sudo yum install -y docker-ce gcc
        git clone https://github.com/openshift/origin
}
function install-go {
        mkdir ~/bin/
        curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
        chmod +x ~/bin/gimme
        export PATH=$PATH:~/bin
        eval `gimme 1.7`
}

setup
install-go
cd origin ;

         # Note this is somewhate EC2 specific, i.e. the metadata_endpoint Stuff !
git checkout v1.5.0
sudo icat <<  EOF > /etc/docker/daemon.json
{
   "insecure-registries": [
     "172.30.0.0/16"
   ]
}
EOF
export metadata_endpoint="http://169.254.169.254/latest/meta-data"
export public_ip="ec2-54-91-100-44.compute-1.amazonaws.com"
export PATH=$PATH:./_output/local/bin/linux/amd64/

./_output/local/bin/linux/amd64/oc cluster up --public-hostname="${public_hostname}" --routing-suffix="${public_ip}.nip.io"

Note, some of the finer points in the env vars are taken largely  from https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md

Now your cluster will be made availeble, publically, like so:

No comments:

Post a Comment