magnum devstack部署

magnum安裝

安裝條件:html

  • 至少要10G以上內存的機器。親測使用6G的虛擬機,全部操做均有至少一秒延遲。
  • 硬盤至少50G
  • 良好的上網環境

操做步驟參見快速入門node

如下是我操做的步驟記錄mysql

sudo mkdir -p /opt/stack
sudo chown $USER /opt/stack

git clone https://git.openstack.org/openstack-dev/devstack /opt/stack/devstack

個人local.conf樣例git

[[local|localrc]]
HOST_IP=10.8.65.216
FIXED_RANGE=10.24.0.0/24
NETWORK_GATEWAY=10.24.0.1
SERVICE_TOKEN=azertytoken
ADMIN_PASSWORD=xxkxxkxxk
DATABASE_PASSWORD=xxkxxkxxk
RABBIT_PASSWORD=xxkxxkxxk
SERVICE_PASSWORD=xxkxxkxxk

PUBLIC_INTERFACE=eth0
enable_plugin magnum https://git.openstack.org/openstack/magnum
LOGFILE=$DEST/logs/stack.sh.log
LOGDAYS=2
enable_service tempest
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta

執行安裝。因爲網絡問題,常常下包失敗,因此失敗時候手動安裝部分包或者從新執行stack.shsql

cd /opt/stack/devstack
./stack.sh

運行magnum

建立flavor

stack@magnum:~/devstack$ nova flavor-create m1.1g 11 1024 20 1
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name  | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+
| 11 | m1.1g | 1024      | 20   | 0         |      | 1     | 1.0         | True      |
+----+-------+-----------+------+-----------+------+-------+-------------+-----------+

建立祕鑰

stack@magnum:~/devstack$ nova keypair-add testkey

建立bay-model

magnum baymodel-create --name k8sbaymodel \
                       --image-id fedora-21-atomic-5 \
                       --keypair-id testkey \
                       --external-network-id public \
                       --dns-nameserver 8.8.8.8 \
                       --flavor-id m1.1g \
                       --docker-volume-size 5 \
                       --network-driver flannel \
                       --coe kubernetes

建立bay

magnum --debug bay-create --name k8sbay --baymodel k8sbaymodel --node-count 1

查看bay

magnum bay-list
magnum bay-show k8sbay

建立pod

首先編寫manifestdocker

[root@A01-R06-I141-86 mysql]# cat mysql.yaml 
apiVersion: v1
kind: Pod
metadata:
  labels:
    name: mysql
    role: master
  name: mysql-pod
spec:
  containers:
    - name: master
      image: index.alauda.cn/tutum/mysql:5.5
      env:
        - name: MYSQL_PASS
          value: admin
      ports:
        - containerPort: 3306

經過命令建立podapi

magnum pod-create --bay k8sbay --manifest mysql.yaml

建立service

首先建立manifestcookie

[root@A01-R06-I141-86 mysql]# cat mysql-service.yaml 
apiVersion: v1
kind: Service
metadata:
  labels:
    name: mysql
    role: service
  name: mysql-service
spec:
  ports:
    - port: 3306
      targetPort: 3306
  type: NodePort
  selector:
    name: mysql

建立service網絡

magnum coe-service-create --bay k8sbay --manifest mysql-service.yaml

建立rc

首先建立manifestide

[root@A01-R06-I141-86 mysql]# cat mysql-rc.yaml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: mysql-controller
spec:
  replicas: 2
  # selector identifies the set of Pods that this
  # replication controller is responsible for managing
  selector:
    name: mysql
  # podTemplate defines the 'cookie cutter' used for creating
  # new pods when necessary
  template:
    metadata:
      labels:
        name: mysql
        role: master
    name: mysql-pod
    spec:
      containers:
        - name: master
          image: index.alauda.cn/tutum/mysql:5.5
          env:
            - name: MYSQL_PASS
              value: admin
          ports:
           - containerPort: 3306

建立rc

magnum rc-create --manifest mysql-rc.yaml --bay k8sbay
相關文章
相關標籤/搜索