Deploying Cloud Foundry on OpenStack using BOSH

本文对使用Bosh 命令行工具在OpenStack上部署Cloud Foundry进行了详细说明,是不可多得的好文,原文国内网站不能上,特简单翻译并转发.

Note: Run all the commands in this topic from the ~/deployments directory that you created in the Deploying MicroBOSH on OpenStack topic.

先决条件

To deploy Cloud Foundry to OpenStack, you must first complete the followingsteps:

  • Install the BOSH Command Line Interface (CLI).
  • Confirm that your OpenStack instance includes four flavors that correspondwith the OpenStack default flavor names m1.small, m1.medium, m1.large, andm1.xlarge.These flavors must have the following listed specifications, at minimum:

    OpenStack Flavor NameCPUsRAM (GB)Disk (GB)Ephemeral Disk (GB)
    m1.small121020
    m1.medium241040
    m1.large481080
    m1.xlarge81610160
  • Validate your OpenStack Instance.

  • Provision an IP address and set your DNS to map * records to this IPaddress.For example, if you use mycloud.com domain as the base domain foryour Cloud Foundry deployment, set a * A record for this zone mapping tothe IP address that you provision.

  • Create an OpenStack security group named cf.Configure the cf security group as follows:

    • Open all ports of the VMs in the cf security group to all other VMs inthe cf security group. This allows the VMs in the cf security groupto communicate with each other.
    • Open port 22 for administrator SSH access.
    • Open port 80 for HTTP traffic.

Target the BOSH Director

Use the bosh target command with the IP address of the BOSH Director toconnect to the BOSH Director.Log in with the default user name and password, admin and admin, or use theuser name and password that you set when you installed BOSH.

$ bosh target https://192.168.109.81:25555
Target set to `bosh'
Your username: admin
Enter password: *****
Logged in as 'admin'

Record the BOSH Director UUID

Use the bosh status command to view information about your BOSH deployment.Record the UUID of the BOSH Director. You use the UUID when Customizing the Cloud Foundry Deployment Manifest Stub for OpenStack.

$ bosh status
Config
             /home/me/.bosh_config

Director
  Name       bosh_openstack
  URL        https://192.168.109.81:25555
  Version    1.2710.0 (00000000)
  User       admin
  UUID       abcdef12-3456-7890-abcd-ef1234567890
  CPI        openstack
  dns        enabled (domain_name: bosh)
  compiled_package_cache disabled
  snapshots  disabled

Deployment
  not set

Upload a Stemcell

  1. Open https://bosh.io/stemcells in a web browserto view a list of publicly available BOSH stemcells.The list displays the most recent build numbers of BOSH stemcells, organized by operating system, target IaaS, and hypervisor.

  2. Choose a BOSH stemcell for OpenStack and click the build number to download.

  3. In a terminal window, run bosh upload stemcell STEMCELL-NAME to upload thestemcell to the BOSH Director.

    $ bosh upload stemcell ./bosh-stemcell-2754-openstack-kvm-ubuntu-trusty-go_agent.tgz
    

Create a Deployment Manifest Stub

Create a manifest stub file named cf-stub.yml.Customize the manifest stub for your environment.

Deploy Cloud Foundry

  1. Clone the cf-release GitHub repository.

    $ git clone https://github.com/cloudfoundry/cf-release.git
    
  2. Use the update helper script to update the cf-release submodules.

    $ cd cf-release
    $ ./update
    
  3. Install spiff.

  4. Run the following spiff command from the cf-release directory to create a deployment manifest named cf-deployment.yml:

    generate_deployment_manifest INFRASTRUCTURE MANIFEST-STUB > cf-deployment.yml

    Replace INFRASTRUCTURE with openstack and replace MANIFEST-STUB with the name and location of your cf-stub.yml file. For example:

    $ ./generate_deployment_manifest openstack cf-stub.yml > cf-deployment.yml
    

    Note: generate_deployment_manifest can accept a list of stub files. For example: generate_deployment_manifest openstack cf-stub.yml cf-consul.yml > cf-dm.yml

    Note: The cf-deployment.yml uses the default OpenStack flavor names of m1.small, m1.medium, m1.large, and m1.xlarge. If your OpenStack instance uses alternate names for these flavors, change the default flavor names in cf-deployment.yml to match the alternate names that your instance uses.

  5. Use bosh target to target the BOSH Director.

    $ bosh target
    Current target is https://192.168.109.81:25555
    
  6. Set your deployment to the generated manifest.

    $ bosh deployment cf-deployment.yml
    
  7. Use bosh create release to create a Cloud Foundry release.This command prompts you for a development release name.

    $ bosh create release
    
  8. Use bosh upload release to upload the generated release to the BOSHDirector.

    $ bosh upload release
    
  9. Deploy the uploaded Cloud Foundry release.

    $ bosh deploy
    

    Note: bosh deploy can take 2-3 hours to complete.

  10. Use curl to test the API endpoint of your Cloud Foundry installation.

    $ curl api.subdomain.domain/info
    

    If curl succeeds, it should return the JSON-formatted information.If curl does not succeeds, check your networking and make sure your domainhas an NS record for your subdomain.

  11. You should be able to target your Cloud Foundry installation with the cf Command Line Interface (CLI) and log in as anadministrator.

    The user name, admin and the password, fakepassword, are specified inthe deployment manifest under uaa:scim:users.

    For more information about managing organizations, spaces, users, andapplications, refer to the cf CLI topic.

Update Cloud Foundry

  • If you make change to your manifest, run bosh deploy to update your CloudFoundry deployment with these changes.

  • If you make changes to the cf-release directory, run bosh create release && bosh upload release && bosh deploy to update your Cloud Foundry deployment with these changes.

Verify the Deployment

  1. Run bosh vms. This command provides an overview of the virtual machines that BOSH manages as part of the current deployment. The state of every VM should show as running.
    $ bosh vms

    +-----------------------------+---------+------------------+---------------+
    | Job/index                   | State   | Resource Pool    | IPs           |
    +-----------------------------+---------+------------------+---------------+
    | nfs_server/0                | running | nfs_server       | 10.146.21.174 |
    | ccdb/0                      | running | ccdb             | 10.146.21.175 |
    | cloud_controller/0          | running | cloud_controller | 10.146.21.176 |
    | collector/0                 | running | collector        | 10.146.21.178 |
    | health_manager/0            | running | health_manager   | 10.146.21.173 |
    | nats/0                      | running | nats             | 10.146.21.172 |
    | router/0                    | running | router           | 10.146.21.171 |
    | syslog/0                    | running | syslog           | 10.146.21.177 |
    | uaa/0                       | running | uaa              | 10.146.21.180 |
    | uaadb/0                     | running | uaadb            | 10.146.21.179 |
    | dea/0                       | running | dea              | 10.146.21.181 |
    | saml_login/0                | running | saml_login       | 10.146.21.181 |
    +-----------------------------+---------+------------------+---------------+
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值