Skip to content

Instantly share code, notes, and snippets.

@cmoulliard
Last active April 25, 2018 07:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmoulliard/039e85e17ee99ad8c9e25b975d3f3a8a to your computer and use it in GitHub Desktop.
Save cmoulliard/039e85e17ee99ad8c9e25b975d3f3a8a to your computer and use it in GitHub Desktop.

Updated : April 24th

Author : Charles Moulliard

Changes:

  • Change cpu to 4, memory to 6Gb, add sudo sysctl -w vm.max_map_count=262144
  • Include minishift instructions

Using Vagrant and Virtualbox

Pre-req

Configure private network between guest and host

This private network will be used between the host and the guest and will let you to access openshift at the address https://192.168.99.50:8443/console from your mac machine

vboxmanage hostonlyif create
vboxmanage hostonlyif ipconfig vboxnet0 --ip 192.168.99.1 --netmask 255.255.255.0
vboxmanage dhcpserver add --ifname vboxnet0 --ip 192.168.99.20 --netmask 255.255.255.0 --lowerip 192.168.99.50 --upperip 192.168.99.50
vboxmanage dhcpserver modify --ifname vboxnet0 --enable

Create Vagrant file to bootstrap Centos vm

mkdir vagrant-centos && vagrant-centos

cat > post-installation.sh << 'EOF'
#!/bin/bash

echo "Install docker, wget packages"
sudo yum install -y git docker wget python-rhsm-certificates

echo "Configure docker"
sudo bash -c "cat > /etc/docker/daemon.json" << 'EOFILE'
  {
    "insecure-registries" : [ "172.30.0.0/16" ],
    "hosts" : [ "unix://", "tcp://0.0.0.0:2376" ]
  }
EOFILE

echo "Start and enable docker service"
sudo groupadd docker
sudo usermod -aG docker vagrant
sudo systemctl enable docker
sudo systemctl start docker

sudo sysctl -w vm.max_map_count=262144
EOF

cat > Vagrantfile << 'EOF'
Vagrant.configure(2) do |config|
  config.vm.box = "centos/7"

  config.vm.provider "virtualbox" do |v, override|
    v.name = "centos-7-docker"
    v.memory = 6144
    v.customize ["modifyvm", :id, "--cpus", "4"]
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end
  
  # Add private network
  config.vm.network "private_network", ip: "192.168.99.50"
  
  # Execute post installation
  config.vm.provision :shell, path: "post-installation.sh"
end    
EOF

Start Vagrant VM

vagrant plugin install ssh
vagrant up

ssh to the vm

vagrant ssh

Install istiooc and launch it

  • Create istiooc folder project and fetch it
mkdir istiooc && cd istiooc
wget -O istiooc https://github.com/openshift-istio/origin/releases/download/istio-3.9-0.7.1-alpha5/istiooc_linux
chmod +x istiooc
export PATH=$(pwd):$PATH
mv istiooc oc
  • Start oc
oc cluster up\
  --public-hostname=192.168.99.50\
  --istio\
  --launcher\
  --launcher-catalog-git-branch='istio'\
  --launcher-catalog-git-repo='https://github.com/snowdrop/launcher-booster-catalog.git'\
  --launcher-openshift-user=admin\
  --launcher-openshift-password=admin\
  --launcher-github-token=''\
  --launcher-github-username=''

Good to know

If you shutdown the cluster and then restart it, then wait 1-2 min as process to create devex namespace containig the launcher pods could take time. See here

Using Minishift - v1.16.1

  • Install istiooc on your machine
mkdir istiooc && cd istiooc
wget -O istiooc https://github.com/openshift-istio/origin/releases/download/istio-3.9-0.7.1-alpha7/istiooc_linux
chmod +x istiooc
mv istiooc oc
cp oc ~/.minishift/cache/oc/v3.9.0/darwin
  • Launch Minishift using extra-flags
minishift config view
- cpus                 : 4
- image-caching        : false
- iso-url              : centos
- memory               : 5G
- openshift-version    : v3.9.0
- vm-driver            : xhyve

MINISHIFT_ENABLE_EXPERIMENTAL=y minishift start --extra-clusterup-flags='--istio
                                                 --launcher
                                                 --launcher-catalog-git-branch=istio
                                                 --launcher-catalog-git-repo=https://github.com/snowdrop/launcher-booster-catalog.git
                                                 --launcher-openshift-user=admin
                                                 --launcher-openshift-password=admin
                                                 --launcher-github-token=""
                                                 --launcher-github-username=""'
@gbraad
Copy link

gbraad commented Apr 19, 2018

Last line should be

- MINISHIFT_ENABLE_EXPERIMENTAL=y minishift start extra-clusterup-flags='--istio'
+ MINISHIFT_ENABLE_EXPERIMENTAL=y minishift start --extra-clusterup-flags='--istio'

@cmoulliard
Copy link
Author

That fails

cp oc /Users/dabou/.minishift/cache/oc/v3.9.0/darwin
MINISHIFT_ENABLE_EXPERIMENTAL=y minishift start --extra-clusterup-flags='--istio'
-- Starting profile 'minishift'
-- Checking if requested OpenShift version 'v3.9.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.9.0' is supported ... OK
-- Checking if requested hypervisor 'xhyve' is supported on this platform ... OK
-- Checking if xhyve driver is installed ...
   Driver is available at /usr/local/bin/docker-machine-driver-xhyve
   Checking for setuid bit ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... Flag 'extra-clusterup-flags' is not supported for oc version v3.9.0. Use 'openshift-version' flag to select a different version of OpenShift.
FAIL
Provided oc flag not supported

@cmoulliard
Copy link
Author

MINISHIFT_ENABLE_EXPERIMENTAL=y minishift start extra-clusterup-flags='--istio --launcher --launcher-catalog-git-branch=istio --launcher-catalog-git-repo=https://github.com/snowdrop/launcher-booster-catalog.git --launcher-openshift-user=admin --launcher-openshift-password=admin --launcher-github-token= --launcher-github-username='
-- Starting profile 'minishift'
-- Checking if https://github.com is reachable (using proxy: "No") ... OK
-- Checking if requested OpenShift version 'v3.9.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.9.0' is supported ... OK
-- Checking if requested hypervisor 'xhyve' is supported on this platform ... OK
-- Checking if xhyve driver is installed ...
   Driver is available at /usr/local/bin/docker-machine-driver-xhyve
   Checking for setuid bit ... OK
-- Checking the ISO URL ... OK
-- Checking if provided oc flags are supported ... OK
-- Starting local OpenShift cluster using 'xhyve' hypervisor ...
-- Starting Minishift VM ................... OK
-- Checking for IP address ... OK
-- Checking for nameservers ... OK
-- Checking if external host is reachable from the Minishift VM ...
   Pinging 8.8.8.8 ... OK
-- Checking HTTP connectivity from the VM ...
   Retrieving http://minishift.io/index.html ... OK
-- Checking if persistent storage volume is mounted ... OK
-- Checking available disk space ... 7% used OK
-- OpenShift cluster will be configured with ...
   Version: v3.9.0
Deleted existing OpenShift container
Using nsenter mounter for OpenShift volumes
Using 192.168.65.5 as the server IP
Starting OpenShift using openshift/origin:v3.9.0 ...
-- Starting OpenShift container ...
   Starting OpenShift using container 'origin'
FAIL
   Error: cannot start OpenShift daemon
   Caused By:
     Error: cannot start container fe2294316a5f473d3c3fb1d026f57c4a4ffe103f7c13465ffeab749ea955441d
     Caused By:
       Error: Error response from daemon: {"message":"oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"start\\\": executable file not found in $PATH\"\n"}

Error during 'cluster up' execution: Error starting the cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment