vagrant启动openshift

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 openshift
Or:
# 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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值