IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]使用Juju将OpenStack部署在单机的LXD容器上(by quqi99)

    quqi99发表于 2016-08-05 19:54:29
    love 0

    **作者:张华 发表于:2016-08-05
    版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
    http://blog.csdn.net/quqi99 )**

    配置LXD

    参考Play with LXD一文 在ubuntu 16.04上部署LXD环境。略。然后继续执行:

    sudo lxc profile create juju-default 2>/dev/null || echo "juju-default profile already exists"
    wget https://api.jujucharms.com/charmstore/v5/~james-page/openstack-on-lxd/archive
    unzip openstack-on-lxd.zip
    sudo modprobe nbd
    cat lxd-profile.yaml | sudo lxc profile edit juju-default
    $ cat lxd-profile.yaml 
    name: juju-default
    config:
      boot.autostart: "true"
      security.nesting: "true"
      security.privileged: "true"
      linux.kernel_modules: openvswitch,nbd,ip_tables,ip6_tables
    devices:
      eth0:
        mtu: "9000"
        name: eth0
        nictype: bridged
        parent: lxdbr0
        type: nic
      eth1:
        mtu: "9000"
        name: eth1
        nictype: bridged
        parent: lxdbr0
        type: nic
      kvm:
        path: /dev/kvm
        type: unix-char
      mem:
        path: /dev/mem
        type: unix-char
      root:
        path: /
        type: disk
      tun:
        path: /dev/net/tun
        type: unix-char

    使用Juju在单机上部署OpenStack

    sudo juju bootstrap --config config.yaml localhost lxd
    sudo lxc exec `sudo lxc list |grep juju- |awk -F '|' '{print $2}'` bash
    $ cat config.yaml 
    default-series: xenial
    agent-stream: devel
    #apt-http-proxy: http://10.0.8.1:8000
    
    sudo juju deploy bundle.yaml
    sudo juju status
    juju debug-log
    $ cat bundle.yaml 
    relations:
    - - nova-compute:amqp
      - rabbitmq-server:amqp
    - - neutron-gateway:amqp
      - rabbitmq-server:amqp
    - - keystone:shared-db
      - mysql:shared-db
    - - nova-cloud-controller:identity-service
      - keystone:identity-service
    - - glance:identity-service
      - keystone:identity-service
    - - neutron-api:identity-service
      - keystone:identity-service
    - - neutron-openvswitch:neutron-plugin-api
      - neutron-api:neutron-plugin-api
    - - neutron-api:shared-db
      - mysql:shared-db
    - - neutron-api:amqp
      - rabbitmq-server:amqp
    - - neutron-gateway:neutron-plugin-api
      - neutron-api:neutron-plugin-api
    - - glance:shared-db
      - mysql:shared-db
    - - glance:amqp
      - rabbitmq-server:amqp
    - - nova-cloud-controller:image-service
      - glance:image-service
    - - nova-compute:image-service
      - glance:image-service
    - - nova-cloud-controller:cloud-compute
      - nova-compute:cloud-compute
    - - nova-cloud-controller:amqp
      - rabbitmq-server:amqp
    - - nova-cloud-controller:quantum-network-service
      - neutron-gateway:quantum-network-service
    - - nova-compute:neutron-plugin
      - neutron-openvswitch:neutron-plugin
    - - neutron-openvswitch:amqp
      - rabbitmq-server:amqp
    - - openstack-dashboard:identity-service
      - keystone:identity-service
    - - nova-cloud-controller:shared-db
      - mysql:shared-db
    - - nova-cloud-controller:neutron-api
      - neutron-api:neutron-api
    - - cinder:image-service
      - glance:image-service
    - - cinder:amqp
      - rabbitmq-server:amqp
    - - cinder:identity-service
      - keystone:identity-service
    - - cinder:cinder-volume-service
      - nova-cloud-controller:cinder-volume-service
    - - cinder-ceph:storage-backend
      - cinder:storage-backend
    - - ceph:client
      - nova-compute:ceph
    - - cinder:shared-db
      - mysql:shared-db
    - - ceph:client
      - cinder-ceph:ceph
    - - ceph:client
      - glance:ceph
    - - ceph-radosgw:mon
      - ceph:radosgw
    - - ceph-radosgw:identity-service
      - keystone:identity-service
    series: xenial
    services:
      ceph:
        annotations:
          gui-x: '750'
          gui-y: '500'
        charm: cs:xenial/ceph
        num_units: 3
        options:
          fsid: 5a791d94-980b-11e4-b6f6-3c970e8b1cf7
          monitor-secret: AQAi5a9UeJXUExAA+By9u+GPhl8/XiUQ4nwI3A==
          osd-devices: /srv/osd
          use-direct-io: False
      ceph-radosgw:
        annotations:
          gui-x: '1000'
          gui-y: '250'
        charm: cs:xenial/ceph-radosgw
        num_units: 1
        options:
          use-embedded-webserver: true
      cinder:
        annotations:
          gui-x: '750'
          gui-y: '0'
        charm: cs:xenial/cinder
        num_units: 1
        options:
          block-device: None
          glance-api-version: 2
      cinder-ceph:
        annotations:
          gui-x: '750'
          gui-y: '250'
        charm: cs:xenial/cinder-ceph
        num_units: 0
      glance:
        annotations:
          gui-x: '250'
          gui-y: '0'
        charm: cs:xenial/glance
        num_units: 1
      keystone:
        annotations:
          gui-x: '500'
          gui-y: '0'
        charm: cs:xenial/keystone
        num_units: 1
        options:
          admin-password: openstack
      mysql:
        annotations:
          gui-x: '0'
          gui-y: '250'
        charm: cs:xenial/percona-cluster
        num_units: 1
        options:
          max-connections: 20000
          dataset-size: 256M
      neutron-api:
        annotations:
          gui-x: '500'
          gui-y: '500'
        charm: cs:xenial/neutron-api
        num_units: 1
        options:
          neutron-security-groups: true
          overlay-network-type: "gre vxlan"
      neutron-gateway:
        annotations:
          gui-x: '0'
          gui-y: '0'
        charm: cs:xenial/neutron-gateway
        num_units: 1
        options:
          ext-port: eth1
      neutron-openvswitch:
        annotations:
          gui-x: '250'
          gui-y: '500'
        charm: cs:xenial/neutron-openvswitch
        num_units: 0
      nova-cloud-controller:
        annotations:
          gui-x: '0'
          gui-y: '500'
        charm: cs:xenial/nova-cloud-controller
        num_units: 1
        options:
          network-manager: Neutron
      nova-compute:
        annotations:
          gui-x: '250'
          gui-y: '250'
        charm: cs:xenial/nova-compute
        num_units: 1
        options:
          enable-live-migration: False
          enable-resize: False
          migration-auth-type: ssh
      openstack-dashboard:
        annotations:
          gui-x: '500'
          gui-y: '-250'
        charm: cs:xenial/openstack-dashboard
        num_units: 1
      rabbitmq-server:
        annotations:
          gui-x: '500'
          gui-y: '250'
        charm: cs:xenial/rabbitmq-server
        num_units: 1

    配置使用OpenStack

    source novarc
    $ cat novarc 
    #!/bin/bash
    export OS_USERNAME=admin
    export OS_PASSWORD=openstack
    export OS_TENANT_NAME=admin
    export OS_REGION_NAME=RegionOne
    export OS_AUTH_URL=${OS_AUTH_PROTOCOL:-http}://`juju run --unit  keystone/0 "unit-get private-address"`:5000/v2.0
    
    curl http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
    openstack image create --public --container-format=bare --disk-format=qcow2 xenial
    
    ./neutron-ext-net -g 10.0.8.1 -c 10.0.8.0/24 \ -f 10.0.8.201:10.0.8.254 ext_net
    ./neutron-tenant-net -t admin -r provider-router \ -N 10.0.8.1 internal 192.168.20.0/24
    
    nova keypair-add --pub-key ~/.ssh/id_rsa.pub mykey
    nova boot --image xenial --flavor m1.small --key-name mykey --nic net-id=$(neutron net-list | grep internal | awk '{ print $2 }') i1
    
    cinder create --name testvolume 10
    nova volume-attach xenial $(cinder list | grep testvolume | awk '{ print $2 }') /dev/vdc
    
    nova floating-ip-create 
    nova add-floating-ip <uuid-of-instance> <new-floating-ip>
    
    neutron security-group-rule-create --protocol icmp --direction ingress $(nova secgroup-list | grep default | awk '{ print $2 }') 
    neutron security-group-rule-create --protocol tcp  --port-range-min 22 --port-range-max 22  --direction ingress $(nova secgroup-list | grep default | awk '{ print $2 }')
    
    ssh ubuntu@<new-floating-ip>
    

    参考

    • https://jujucharms.com/u/james-page/openstack-on-lxd这里写链接内容


沪ICP备19023445号-2号
友情链接