OpenStack magnum

此篇也是古文,將以前學習的過程搬上來

本測試devstack裝在實體機的環境下是可行的,但是devstack裝在虛擬機上, 建立k8s的master會失敗。 (更新)官網Ocata和Pike版已經更新magnum了,可以不用透過devstack安裝最新版

Reference:

Install OpenStack from Devstack

  • Clone devstack

    git clone https://github.com/openstack-dev/devstack.git
  • Edit local.confg

    [[local|localrc]]
    
    ADMIN_PASSWORD=openstack
    DATABASE_PASSWORD=openstack
    RABBIT_PASSWORD=openstack
    SERVICE_PASSWORD=$ADMIN_PASSWORD
    
    HOST_IP=10.0.2.7
    
    # Logging
    LOGFILE=$DEST/logs/stack.sh.log
    
    # Old log files are automatically removed after 7 days to keep things neat.  Change
    # the number of days by setting ``LOGDAYS``.
    LOGDAYS=2
    
    # Nova logs will be colorized if ``SYSLOG`` is not set; turn this off by setting
    # ``LOG_COLOR`` false.
    #LOG_COLOR=False
    
    # Swift
    # -----
    
    # Swift is now used as the back-end for the S3-like object store. Setting the
    # hash value is required and you will be prompted for it if Swift is enabled
    # so just set it to something already:
    SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
    
    # For development purposes the default of 3 replicas is usually not required.
    # Set this to 1 to save some resources:
    SWIFT_REPLICAS=1
    
    # The data for Swift is stored by default in (``$DEST/data/swift``),
    # or (``$DATA_DIR/swift``) if ``DATA_DIR`` has been set, and can be
    # moved by setting ``SWIFT_DATA_DIR``. The directory will be created
    # if it does not exist.
    SWIFT_DATA_DIR=$DEST/data
    
    PUBLIC_INTERFACE=eno1
    FLOATING_RANGE=10.0.2.0/22
    PUBLIC_NETWORK_GATEWAY=10.0.3.254
    Q_FLOATING_ALLOCATION_POOL=start=10.0.2.70,end=10.0.2.79
    Q_USE_PROVIDERNET_FOR_PUBLIC=False
    Q_ASSIGN_GATEWAY_TO_PUBLIC_BRIDGE=False
    # Magnum
    enable_plugin barbican https://git.openstack.org/openstack/barbican
    enable_plugin heat https://git.openstack.org/openstack/heat
    enable_plugin magnum https://git.openstack.org/openstack/magnum
    enable_plugin magnum-ui https://github.com/openstack/magnum-ui
    
    VOLUME_BACKING_FILE_SIZE=40G
    enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas
    enable_plugin octavia https://git.openstack.org/openstack/octavia
    
    # Disable LBaaS(v1) service
    disable_service q-lbaas
    # Enable LBaaS(v2) services
    enable_service q-lbaasv2
    enable_service octavia
    enable_service o-cw
    enable_service o-hk
    enable_service o-hm
    enable_service o-api
  • install devstack

    ./stack

Magnum cluster template create

  • create magnum cluster template

Create magnum cluster

  • Create magnum cluster

Setting up the environment and artifacts for TLS

  • Setting up the environment and artifacts for TLS

  • Edit config and modify path of certificate-authority,client-certificate,client-key

linux connect to k8s cluster

  • linux connect to k8s cluster and Verify connection

windows connect to k8s cluster

  • Installing Chocolatey

  • First, ensure that you are using an administrative shell - you can also install as a non-admin, check out Non-Administrative Installation.

  • Copy the text specific to your command shell - cmd.exe.

  • Paste the copied text into your shell and press Enter.

  • Wait a few seconds for the command to complete.

  • if you don't see any errors, you are ready to use Chocolatey!

  • Use choco command to install kubectl.

  • Copy config and key from k8s-cluster server and create .kube directory.

  • Edit config and modify path of certificate-authority,client-certificate,client-key

  • Verify your connection

Run proxy and access dashboard from localhost

Access dashboard from NodePort

  • Change dashboard service type clusterIP to NodePort

  • Get dasboard port

Open browesr and k8s dashboard url is(master IP:port) http://10.0.2.74:30809

Example : Create Guestbook app from yaml

  • Clone example from k8s gitub

  • Edit example yaml and modify type:LoadBalancer to type:NodePort from frontend service section.

  • Create Guestbook app

  • Check your guestbook service

  • Access your guestbook from k8s master or minion floating ip and service port (you can get port form command kubectl get services) , For example: k8s master floating ip is 10.0.2.74, access guestgook url is 10.0.2.74:32020

Use helm manage k8s package

Install helm tool

  • wget helm tool and install

  • helm initialization

  • Check tiller service has been created

using helm to install app - jenkins

  • helm repository update

  • Search jenkins

  • Create jenkins app

  • Check jenkins deploy complete

  • You can accsee jenkins by EXTERNAL-IP, but this k8s cluster in openstack vm , so you must access by master or minion floating ip and port, edit jenkins service .

    * Remove about Loadbalance and change type to NodePort

  • Get jenkins service port

  • Get jenkins password

Login jenkins

Last updated

Was this helpful?