[置顶] OpenStack使用Bosh部署CloudFoundry(三)—部署Micro Bosh

版本说明:

CloudFoundry:V2版本-v149+(本文后续章节中的Manifest适用于149+版本的CF Release)

OpenStack:Grizzly版本+nova-network

CloudFoundry部署交流QQ群:176302388

本文介绍如何在OpenStack环境中部署Micro Bosh,Micro Bosh其实就是Bosh,不过是将分布式的Bosh浓缩到一个机器节点上,用于小规模化部署分布式的Bosh环境,事实上,也可以直接使用Micro Bosh来部署CloudFoundry,不过Micro Bosh只适用于小规模部署的情况,大规模的生产环境如果使用Micro Bosh还是不太适合;


下边是具体的部署步骤:

1、下载Micro Bosh Stemcell

root@bosh-cli:~# mkdir -p ~/bosh-workspace/stemcells
root@bosh-cli:~# cd ~/bosh-workspace/stemcells
root@bosh-cli:~# wget http://bosh-jenkins-artifacts.s3.amazonaws.com/bosh-stemcell/openstack/bosh-stemcell-latest-openstack-kvm-ubuntu.tgz

或者直接使用Bosh下载:

root@bosh-cli:~# bosh public stemcells
+---------------------------------------------+
| Name                                        |
+---------------------------------------------+
| bosh-stemcell-1623-aws-xen-ubuntu.tgz       |
| bosh-stemcell-1623-aws-xen-centos.tgz       |
| light-bosh-stemcell-1623-aws-xen-ubuntu.tgz |
| light-bosh-stemcell-1623-aws-xen-centos.tgz |
| bosh-stemcell-1623-openstack-kvm-ubuntu.tgz |
| bosh-stemcell-1623-vsphere-esxi-ubuntu.tgz  |
| bosh-stemcell-1623-vsphere-esxi-centos.tgz  |
+---------------------------------------------+
To download use `bosh download public stemcell <stemcell_name>'. For full url use --full.
root@bosh-cli:~# bosh download public stemcell bosh-stemcell-1623-openstack-kvm-ubuntu.tgz

鉴于国际出口带宽的限制,下载可能需要耗费一点时间,强烈建议国内同学使用直接下载的方式并且最好使用迅雷等具有断点续传功能的下载工具下载,等待过程中可以继续下面的步骤。

说明:本环境中所有使用到Stemcell模板的地方都统一使用bosh-stemcell-latest-openstack-kvm-ubuntu.tgz

2、创建部署Micro Bosh的Manifest文件

root@bosh-cli:~# mkdir -p ~/bosh-workspace/deployments/microbosh-openstack
root@bosh-cli:~# cd ~/bosh-workspace/deployments/microbosh-openstack
root@bosh-cli:~# vi micro_bosh.yml

配置内容可以参照:

---
name: microbosh-openstack

logging:
  level: DEBUG

network:
  type: dynamic
  vip: 10.68.19.130 # Floating IP

resources:
  persistent_disk: 16384
  cloud_properties:
    instance_type: v1.small

cloud:
  plugin: openstack
  properties:
    openstack:
      auth_url: http://10.68.19.61:5000/v2.0
      username: VF     # openstack username
      api_key: 1       # openstack api_key
      tenant: VF_CF    # openstack tenant
      region: myregion # openstack region
      default_security_groups: ["default"] # using default security groups
      default_key_name: vkey  # key name as cf created earlier
      private_key: ~/vkey.pem # pem file by uploading yourself

apply_spec:
  properties:
    director:
      max_threads: 3
    hm:
      resurrector_enabled: true
    ntp:
      - 0.north-america.pool.ntp.org
      - 1.north-america.pool.ntp.org

注意其中的编写说明,文件内不太适合使用中文,故英文说明。

3、部署Micro Bosh

设置Micro Bosh 部署文件:

root@bosh-cli:~# cd ~/bosh-workspace/deployments
root@bosh-cli:~/bosh-workspace/deployments# bosh micro deployment microbosh-openstack
Deployment set to '/root/bosh-workspace/deployments/microbosh-openstack/micro_bosh.yml'
使用上边下载好的Stemcell部署Micro Bosh:

root@bosh-cli:~/bosh-workspace/deployments# bosh micro deploy ~/bosh-workspace/stemcells/bosh-stemcell-latest-openstack-kvm-ubuntu.tgz
部署成功提示bosh target切换信息:

WARNING! Your target has been changed to `https://10.68.19.130:25555'!
Deployment set to '/root/bosh-workspace/deployments/microbosh-openstack/micro_bosh.yml'
Deployed `microbosh-openstack/micro_bosh.yml' to `https://microbosh-openstack:25555', took 00:07:08 to complete

4、登陆到Micro bosh 的director并创建账号

Target到Micro Bosh的director

root@bosh-cli:~/bosh-workspace/deployments#bosh target https://10.68.19.130:25555

初始账号:admin/admin

root@bosh-cli:~/bosh-workspace/deployments# bosh login
Your username: admin
Enter password: *****
Logged in as `admin'
创建账号,并使用创建的账号登陆

root@bosh-cli:~/bosh-workspace/deployments# bosh create user
Enter new username: venusource
Enter new password: **********
Verify new password: **********
User `venusource' has been created
root@bosh-cli:~/bosh-workspace/deployments# bosh login
Your username: venusource
Enter password: **********
Logged in as `venusource'
查看bosh状态

root@bosh-cli:~# bosh target https://10.68.19.130
Target set to `microbosh-openstack'
root@bosh-cli:~# bosh status
Config
             /root/.bosh_config

Director
  Name       microbosh-openstack
  URL        https://10.68.19.130:25555
  Version    1.5.0.pre.1478 (release:a8e43f41 bosh:a8e43f41)
  User       venusource
  UUID       5d8c682c-290a-4194-bfc6-60248567ceab
  CPI        openstack
  dns        enabled (domain_name: microbosh)
  compiled_package_cache disabled
  snapshots  disabled

Deployment
  Manifest   /root/bosh-workspace/deployments/bosh-openstack/bosh-openstack.yml

你可能感兴趣的:(ubuntu,openstack,BOSH,CloudFoundry)