Kolla部署Stein版OpenStaak

2019-04-10  本文已影响0人  我问你瓜保熟吗
环境说明

我的机器配置是在VMware15创建的虚拟机,具体配置如下:
Centos7.4
16G内存
200G硬盘
双网卡:一个nat网卡,一个仅主机网卡,用作管理网络,不能配置ip地址

# ens32
TYPE=Ethernet
BOOTPROTO=static
DEVICE=ens32
ONBOOT=yes
IPADDR=172.16.1.8
NETMASK=255.255.255.0
GATEWAY=172.16.1.2
DNS1=172.16.1.2

# ens33
TYPE=Ethernet
BOOTPROTO=static
DEVICE=ens33
ONBOOT=yes
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:27:f7:e0 brd ff:ff:ff:ff:ff:ff
    inet 172.16.1.8/24 brd 172.16.1.255 scope global noprefixroute ens32
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe27:f7e0/64 scope link 
       valid_lft forever preferred_lft forever
3: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:27:f7:ea brd ff:ff:ff:ff:ff:ff
初始化系统环境

hostnamectl set-hostname openstack
systemctl stop NetworkManager firewalld
systemctl disable NetworkManager firewalld
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 0
# egrep "vmx|svm" /proc/cpuinfo
安装Docker

wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 默认安装最新版
yum install docker-ce  -y  

# 查看可安装的docker 版本
yum list docker-ce.x86_64  --showduplicates | sort -r
# 1、如果不设置此项,kolla-ansible 部署neutron-dhcp-agent 容器的时候会失败,并抛出 APIError/HTTPError
mkdir /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/kolla.conf << 'EOF'
[Service]
MountFlags=shared
EOF

# 2、更改国内源、指定文件系统格式
vim /usr/lib/systemd/system/docker.service
# ExecStart=/usr/bin/dockerd
# 设置国内的daocloud.io镜像源,指定overlay2系统格式,docker默认就是overlay2
ExecStart=/usr/bin/dockerd --registry-mirror=http://f2d6cb40.m.daocloud.io --storage-driver=overlay2
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
systemctl status docker
docker info
安装ansible

yum install gcc openssl-devel git  wget vim -y
yum install epel-release -y
yum install python-pip -y
pip install -U pip
yum -y install python-devel libffi-devel gcc openssl-devel libselinux-python
yum -y install ansible
pip install -U ansible
[defaults]
host_key_checking=False
pipelining=True
forks=100
安装kolla-ansible

git clone https://github.com/openstack/kolla-ansible -b stable/stein
git clone https://github.com/openstack/kolla-ansible -b stable/stein
pip install -r kolla/requirements.txt
pip install -r kolla-ansible/requirements.txt

# 如果不能使用kolla-ansible命令,执行以下操作
cd kolla-ansible
# 下面的命令会执行setup.py脚本,安装kolla-ansible
pip install . -i https://pypi.tuna.tsinghua.edu.cn/simple
mkdir -p /etc/kolla
cp -r kolla-ansible/etc/kolla/* /etc/kolla
cp kolla-ansible/ansible/inventory/* .
# 单节点
ansible -i all-in-one all -m ping

# 多节点
ansible -i multinode all -m ping
# 自动生成所有需要的密码
cd kolla-ansible/tools
./generate_passwords.py

自定义登录密码
keystone_admin_password: admin

安装kolla

[root@openstack ~]# grep ^[^#] /etc/kolla/globals.yml 
kolla_base_distro: "centos"
kolla_install_type: "source"
openstack_release: "stein"
kolla_internal_vip_address: "172.16.1.8"
network_interface: "ens32"
neutron_external_interface: "ens33"
enable_haproxy: "no"
glance_enable_rolling_upgrade: "no"
nova_compute_virt_type: "qemu"
ironic_dnsmasq_dhcp_range:
tempest_image_id:
tempest_flavor_ref_id:
tempest_public_network_id:
tempest_floating_network_name:
kolla-ansible prechecks
kolla-ansible pull
拉取的OpenStack组件镜像.png
kolla-ansible deploy
 kolla-ansible post-deploy
pip install python-openstackclient

执行openstack命令报错:Could not find a version that satisfies the requirement python-decorator (from versions: )
yum -y install python-decorator 提示已经安装

以下两种方案二选一
跳过已安装的包: pip install --ignore-installed python-openstackclient
升级已安装的decorator:pip install -U decorator

vim /usr/share/kolla-ansible/init-runonce

EXT_NET_CIDR='192.168.1.0/24'
EXT_NET_RANGE='start=192.168.1.100,end=192.168.1.254'
EXT_NET_GATEWAY='192.168.1.1'
source /etc/kolla/admin-openrc.sh
cd /usr/share/kolla-ansible/ && ./init-runonce
openstack server create \
    --image cirros \
    --flavor m1.tiny \
    --key-name mykey \
    --network demo-net \
    demo1
kolla-ansible destroy --yes-i-really-really-mean-it
kolla-ansible/tools/cleanup-containers
kolla-ansible/tools/cleanup-host

# 可用于从系统中移除部署的容器:
tools/cleanup-containers
# 可用于移除由于网络变化引发的 Docker 启动的neutron-agents 主机:
tools/cleanup-host
# 可用于从本地缓存中移除所有的 Docker image
tools/cleanup-images
故障诊断与排除

docker ps

docker ps -a 查看所有安装的容器

docker logs container_name

直接 CD 到主机的 /var/lib/docker/volumes/kollalogs/data/ 目录下,查看指定服务的日志信息。

docker exec -it -u root container_name bash
新增组件

模块介绍

Telemetry包含以下四个组件

Ceilometer (收集数据)
gnocchi (监控数据)
aodh (报警)
panko (event)
gnocchi的数据,还可以通过grafana来做展示

CloudKitty
这是OpenStack的计费模块,可以通过gnocchi来取数据进行计费工作

上一篇 下一篇

猜你喜欢

热点阅读