可以查看此处代替本blog:(此处描述比较详细,但为全英文描述)
http://github.com/lenovo/workload-solution/wiki/Build-Juju-&-MAAS-on-KVM
以下操作均为root用户
install juju
ref:https://jujucharms.com/docs/stable/reference-install
on ubuntu 16.04
root@juju-KVM:~# snap install juju --classic
You can check which version of Juju you have installed with
root@juju-KVM:~# snap list juju
And update it if necessary with:
root@juju-KVM:~# snap refresh juju
Note: you can use the PPA for a stable deb package as well:
root@juju-KVM:~# add-apt-repository --update ppa:juju/stable
root@juju-KVM:~# apt install juju
.
.
.
install maas:
ref:https://docs.ubuntu.com/maas/2.1/en/installconfig-package-install
on ubuntu
查看依赖
root@maas-KVM:~# apt-cache search maas
The recommended way to set up an initial MAAS environment is to put everything on one machine:
root@maas-KVM:~# apt install -y maas
For a more distributed environment, the region controller can be placed on one machine:
root@maas-KVM:~# apt install maas-region-controller
and the rack controller on another:
root@maas-KVM:~# apt install maas-rack-controller
root@maas-KVM:~# maas-rack register
设置用户maas属性
sudo chsh -s /bin/bash maas
sudo su - maas
ssh-keygen -f ~/.ssh/id_rsa -N ''
创建UI用户:
root@maas-KVM:~# maas createadmin --username=admin --email=admin@example.com
其中,email实际上是没有用到的,但是不可以不写,执行后,会提示输入密码。
安装libvirt-bin
root@maas-KVM:~# apt-get install -y libvirt-bin
当选择KVM上的VM作为node时,需要安装libvirt-bin,否则会添加chassis不成功,或在添加完machine后会报如下错误。
Power control software for this power type is missing from the rack controller. To proceed, install the libvirt-bin package on the rack controller.
对于add chassis(KVM上的虚机),UI上地址(address)栏填写如下:
qemu+ssh://root@10.240.217.72/system
ref:https://docs.ubuntu.com/maas/2.1/en/nodes-add
测试:
virsh -c qemu+ssh://root@10.240.217.72/system list --all
.
.
.
将juju与maas结合起来
ref:https://jujucharms.com/docs/stable/clouds-maas
2.0version:
root@juju-KVM:~# cat maas-clouds.yaml
clouds:
maas-cloud:
type: maas
auth-types: [oauth1]
endpoint: http://192.168.100.4/MAAS
root@juju-KVM:~# juju add-cloud maas-cloud maas-clouds.yaml
2.2version:
root@juju-KVM:~# juju add-cloud
Cloud Types
maas
manual
openstack
oracle
vsphere
Select cloud type: maas
Enter a name for your maas cloud: maas-cloud
Enter the API endpoint url: http://192.168.101.4:5240/MAAS
也可以手动移除 cloud
juju remove-cloud maas-cloud
在juju上添加认证:
root@juju-KVM:~# juju add-credential maas-cloud
Enter credential name: maas-cloud-creds
Using auth-type "oauth1".
Enter maas-oauth:
该值可以从maas命令行获取
maas-region apikey --username=admin
或者从maas界面上获取。
点击maas界面右上角的已登录用户名,即可显示所需的keys
设置MAAS maas-region-controller
root@maas-KVM:~# dpkg-reconfigure maas-region-controller
192.168.100.4 #(ip of maas)
设置完毕juju-maas之后在maas界面执行commission,获取机器硬件信息。 .
.
.
juju commands:
[cloud]
juju clouds
juju show-clouds testmaas
[controller]
juju bootstrap --bootstrap-series=centos7 --config bootstrap-timeout=900 maas-cloud maas-controller
juju bootstrap --config default-series=centos7 maas-cloud maas-controller
juju bootstrap --bootstrap-series=trusty maas-cloud maas-controller
juju bootstrap --bootstrap-series=xenial maas-cloud maas-controller
juju controllers
juju deploy $JUJU_REPOSITORY/trusty/vanilla --series xenial
juju destroy-controller maas-controller --destroy-all-models
juju switch maas-controller
juju gui --show-credentials
[machine]
juju machines
juju add-machine
juju remove-machine 4
.
.
.
-------------------------------------TDB-------------------------------------