标签:
BOSH是CloudFoundry提供的用来安装部署和升级CloudFoundry的自动化工具,可是说是CloudFoundry的一部分。总体来说,BOSH是Client/Server结构, BOSH客户端称作BOSH CLI,BOSH服务器端由BOSH Director,NATS,HealthMonitor等组件组成, 详见http://docs.cloudfoundry.org/bosh/
完整的BOSH是一个分布式的环境,本文为了简化BOSH的安装,将BOSH所有的组件安装在一个虚拟机上,BOSH的这种部署方式称为MicroBOSH。
将描述如果在CentOS环境下部署BOSH客户端和在OpenStack环境上部署MicroBOSH工具。
3.1 安装ruby环境
3.1.1 作者使用rbenv来管理ruby,所以安装rbenv和ruby 环境 (如果rbenv已经安装完成或者使用rvm可跳过此步)
3.1.2 安装bosh客户端
3.1.3 为安置MicroBosh和CloudFoundry配置SecurityGroup
(1) 创建BOSH security group,允许bosh访问
(2) 创建security group, 允许SSH 访问
(3) 创建Cloudfoundry内网security group
(4) 创建CloudFoundry外网访问security group
3.2 部署MicroBosh
3.2.1 创建microbosh keypair
3.2.2 创建工作目录
3.2.3 为microbosh创建一个floating ip
- +--------------+-----------+----------+--------+
- | Ip | Server Id | Fixed Ip | Pool |
- +--------------+-----------+----------+--------+
- | 172.24.4.229 | | - | public |
- +--------------+-----------+----------+--------+
3.2.4 创建并且编辑部署描述文件microbosh.yml
- ---
- name: microbosh-openstack
-
- logging:
- level: DEBUG
-
- network:
- type: dynamic
- vip: 172.24.4.229
- cloud_properties:
- net_id: bfc9b30b-8b44-4f97-a762-c39b2f774d78
-
- resources:
- persistent_disk: 16384
- cloud_properties:
- instance_type: m1.medium
-
- cloud:
- plugin: openstack
- properties:
- openstack:
- auth_url: http://<ip>:5000/v2.0
- username: demo
- api_key: 73b3b497ca3a42d1
- tenant: demo
- default_security_groups: ["ssh", "bosh"]
- default_key_name: microbosh
- private_key: $HOME/microbosh.cer
-
- apply_spec:
- properties:
- director:
- max_threads: 3
- hm:
- resurrector_enabled: true
- ntp:
- - <ntp server ip>
下面简单介绍一下此部署文件的含义
* network 描述了Openstack中network的属性
在笔者的Openstack环境中,网络为openstack neutron network,所以在内网使用dhcp获取ip, 因此type为dynamic。cloud_properties中的net_id是可以使用dhcp获得ip的内网地址,此id可以使用neutron net-list得到
- +--------------------------------------+---------+--------------------------------------------------+
- | id | name | subnets |
- +--------------------------------------+---------+--------------------------------------------------+
- | 0fbe7f27-e732-4954-9134-5486d7617727 | public | 110583d9-a905-428a-a494-3c95e4a6bca6 |
- | bfc9b30b-8b44-4f97-a762-c39b2f774d78 | private | 052030e6-626a-4a57-b8dc-b8ab239f419d 10.0.0.0/24 |
- +--------------------------------------+---------+--------------------------------------------------+
为了能够从外网访问microbosh,我们需要为bosh director指定一个floating ip, bosh会自动把这个ip关联到bosh director
* resource描述了为micro bosh director分配多少资源,instance_type定义了此虚拟机的openstack flavor,persistent_disk定义了为此虚拟机挂接多大的永久磁盘
* cloud描述了如何访问openstack,其中大部分内容可以从安装产生的keystonerc_demo中找到,
- export OS_USERNAME=demo
- export OS_TENANT_NAME=demo
- export OS_PASSWORD=73b3b497ca3a42d1
- export OS_AUTH_URL=http://<ip>:35357/v2.0/
- export PS1=‘[\u@\h \W(keystone_demo)]\$ ‘
* apply_spec定义了Micro bosh得属性,这里面我们只需要修改一项,那就是时间服务器的地址<ntp server ip>, 例如修改为time.asia.apple.com
3.2.5 下载microbosh的虚拟机模板(stemcell)
(1) 由于GFW的缘故,把下面这句加到/etc/hosts中
54.231.244.8 s3.amazonaws.com
(2) 创建stemcell目录
(3) 下载micro bosh的stemcell
- | bosh-stemcell-2427-openstack-kvm-ubuntu.tgz |
- | bosh-stemcell-2624-openstack-kvm-centos.tgz |
- | bosh-stemcell-2624-openstack-kvm-ubuntu-lucid.tgz |
- | bosh-stemcell-2749-openstack-kvm-centos-go_agent.tgz |
- | bosh-stemcell-2749-openstack-kvm-ubuntu-trusty-go_agent.tgz |
- | bosh-stemcell-2652-openstack-kvm-ubuntu-lucid-go_agent.tgz |
- | bosh-stemcell-2719.1-openstack-kvm-centos-go_agent.tgz |
- | bosh-stemcell-2719.1-openstack-kvm-ubuntu-trusty-go_agent.tgz |
- | bosh-stemcell-2719.2-openstack-kvm-centos-go_agent.tgz |
- | bosh-stemcell-2719.2-openstack-kvm-ubuntu-trusty-go_agent.tgz |
- | bosh-stemcell-2719.3-openstack-kvm-ubuntu-trusty-go_agent.tgz |
这个stemcell虽然不是最新版,但是笔者验证通过,更新版本的stemcell笔者没有尝试
(4) 部署Micro Bosh
*设置部署描述文件
* 部署Micro Bosh
(5) 验证Micro Bosh
其中的microbosh ip address是预先申请的floating ip
(6) 使用ssh访问micro bosh
开源的PaaS方案:在OpenStack上部署CloudFoundry (三)部署BOSH
标签:
原文地址:http://www.cnblogs.com/yudar/p/4391539.html