vagrant启动openshift

来源:互联网 发布:js返回并重载页面 编辑:程序博客网 时间:2024/05/21 16:54

1,Install Vagrant

2,Install VirtualBox (Ex: yum install VirtualBox from the RPM Fusion repository)

3,In your .bashrc file or .bash_profile file, set a GOPATH:

export GOPATH=$HOME/go

Clone the project and change into the directory:

$ mkdir -p $GOPATH/src/github.com/openshift$ cd $GOPATH/src/github.com/openshift$ git clone git://github.com/<forkid>/origin  # Replace <forkid> with the your github id$ cd origin$ git remote add upstream git://github.com/openshift/origin

4,Bring up the VM
在这一步,为了节省时间可以提前将VM的模板box下载好,加入vagrant环境中。
(If you are new to Vagrant, consider Vagrant Docs for help on items like provider selection. Also consider the enablement of your hardware’s virtualization extensions,
such as RHEL for example.).
Also note, for the make clean build in step 7 to work, a sufficient amount of memory needs to be allocated for the VM,
where that amount of memory is not necessarily needed if you are not doing a compile,
but simply running openshift (and hence is not set as the default):

$ export OPENSHIFT_MEMORY=4192$ vagrant up

Tip
5, To ensure you get the latest image first run vagrant box remove fedora_inst. And if later on you employ a dev cluster, additionally run vagrant box remove fedora_deps.
You are now ready to edit the source, rebuild and restart OpenShift to test your changes. SSH in:

$ vagrant ssh

6, Run a build:

$ cd /data/src/github.com/openshift/origin$ make clean build

在这一步我遇到了一个问题,报错为can not allocate memory。解决方法为,1)加大vagrant VM的内存 2)升级VM中go的版本为1.7或以上
Now start the OpenShift server:

$ sudo systemctl start openshiftOr:# must cd / to use prepopulated $KUBECONFIG$ cd /# redirect the logs to /home/vagrant/openshift.log for easier debugging$ sudo `which openshift` start --public-master=localhost &> $HOME/openshift.log &

Note
This will generate three directories in / (openshift.local.config, openshift.local.etcd, openshift.local.volumes) as well as create the /home/vagrant/openshift.log file.
Note
By default your origin directory (on your host machine) will be mounted as a vagrant synced folder into /data/src/github.com/openshift/origin.
Deploy the private docker registry within OpenShift with the following command:

$ oadm registry

At this point it may be helpful to load some image streams and templates. These commands will make use of fixtures from the openshift/origin/examples dir:

# load image streams$ oc create -f /data/src/github.com/openshift/origin/examples/image-streams/image-streams-centos7.json -n openshift# load templates$ oc create -f /data/src/github.com/openshift/origin/examples/sample-app/application-template-stibuild.json -n openshift$ oc create -f /data/src/github.com/openshift/origin/examples/db-templates -n openshift

At this point you can open a browser on your host system and navigate to https://localhost:8443/console to view the web console. You can log in with any username and password combination.

NOTE: to properly stop OpenShift and clean up, so that you can start fresh instance of OpenShift, execute:

# shut down openshift$ sudo pkill openshift# stop the docker containers$ docker ps | awk 'index($NF,"k8s_")==1 { print $1 }' | xargs -l -r docker stop# deleting all the internal config files, etcd, etc and starting openshift fresh$ sudo rm -rf openshift.local.*# if you used the --volume-dir=/home/vagrant/volumes flag, then run these
0 0
原创粉丝点击