2018 졸작 게시판

Devstack 설치 (실습용)

작성자
admin
작성일
2018-01-18 14:41
조회
316
0. Devstack 용 VM 생성 (192.168.11.254 서버 접속)
******************
** 접속 아이디 패스 설정
******************
vi passwd.sh
#cloud-config
chpasswd:
list: |
root:root
ubuntu:ubuntu
expire: False
ssh_pwauth: True

******************
** VM 생성
******************
. /opt/stack/devstack/openrc ykpark ykpark ykpark123!

openstack server list
openstack image list -c Name
openstack flavor list -c Name

## Devstack controller & compute node (All-in-One)
openstack server create \
--image xenial-server-key \
--flavor devstack \
--user-data passwd.sh \
--network public \
--network public \
--network devstack_net \
devstack-aio

## Devstack compute node (All-in-One)
openstack server create \
--image xenial-server-key \
--flavor devstack-com \
--user-data passwd.sh \
--network public \
--network devstack_net \
devstack-com1

openstack server list


******************
** VM NIC의 port_security_enabled 을 disabled
******************
vi /etc/neutron/policy.json
"update_port:port_security_enabled": "rule:context_is_advsvc or rule:admin_or_network_owner or rule:shared"

# openstack port list | awk '/브릿지 네트워크에 사용할 IP/ {print $2}'
openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/192.168.9.13/ {print $2}')

openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/10.10.10.3/ {print $2}')

openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/10.10.10.7/ {print $2}')



## devstack install (Devstack 용 VM에 접속 후 root 유저로 작업)
1. sources.list 의 주소 변경
cp /etc/hosts /etc/hosts.org
echo "127.0.0.1 localhost $HOSTNAME" > /etc/hosts

cp /etc/apt/sources.list /etc/apt/sources.list.org
cat /etc/apt/sources.list
sed -i 's/nova.clouds.archive.ubuntu.com/ftp.daumkakao.com/g' /etc/apt/sources.list
sed -i 's/security.ubuntu.com/ftp.daumkakao.com/g' /etc/apt/sources.list

apt update && apt dist-upgrade -y

2. stack user 생성 및 devstack 패키지 다운
useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/stack

******************
** profile의 PATH 추가
******************
vi /etc/profile.d/apps-bin-path.sh
PATH=$PATH:/snap/bin
-->
PATH=$PATH:/snap/bin:/sbin

******************
** stack 유저로 변경
******************
sudo su - stack

******************
** 패키지 다운
******************
git clone https://git.openstack.org/openstack-dev/devstack
cd devstack

******************
** 설치를 위한 local.conf 생성 (Controller node)
******************
vi local.conf
[[local|localrc]]
HOST_IP=192.168.9.11
FLAT_INTERFACE=ens3

ADMIN_PASSWORD=1234
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
MULTI_HOST=1
LOGFILE=$DEST/logs/stack.sh.log
LOGDAYS=2

###############################
## Swift
ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=1
SWIFT_DATA_DIR=$DEST/data

###################################
disable_service tempest

******************
** 설치를 위한 local.conf 생성 (Compute node)
******************
vi local.conf
[[local|localrc]]
HOST_IP=192.168.9.4

ADMIN_PASSWORD=1234
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
MULTI_HOST=1

LOGFILE=$DEST/logs/stack.sh.log
LOGDAYS=2

DATABASE_TYPE=mysql
SERVICE_HOST=192.168.9.11
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOST=$SERVICE_HOST
ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,placement-client
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
VNCSERVER_LISTEN=$HOST_IP
VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN


******************
** 설치
******************
./stack.sh


3. 설치 후 작업 (Controller node)
******************
** 서버재부팅시 swift 안되는 문제
******************
vi /etc/fstab
/opt/stack/data/drives/images/swift.img /opt/stack/data/drives/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 2


******************
** 서버재부팅시 swift 안되는 문제 (init_lvm_volume_group)
** devstack/lib/lvm
** devstack/lib/cinder_backends/lvm
******************
vi /etc/rc.local
/sbin/losetup -f --show /opt/stack/data/stack-volumes-default-backing-file
/sbin/losetup -f --show /opt/stack/data/stack-volumes-lvmdriver-1-backing-file
exit 0

******************
** bridge되는 interface 의 MAC 어드레스를 br-ex 에 적용 하기
** br-ex mac := ens3 interface mac
******************
ovs-vsctl del-br br-ex
ovs-vsctl --may-exist add-br br-ex -- set bridge br-ex other-config:hwaddr=$(cat /sys/class/net/ens4/address)
ovs-vsctl add-port br-ex ens4
ifconfig br-ex && ifconfig ens4

vi /etc/network/interfaces
auto ens4
iface ens4 inet manual

## reboot
reboot


4. Multil node 설치시 브릿지 네트워크 수정


******************
** Controller <--> Compute 통신을 위한 브릿지 생성
******************
## Controller node 에서 작업 (root mode)
ovs-vsctl --may-exist add-br br-pri
ovs-vsctl add-port br-pri ens5

vi /etc/network/interfaces
...
auto br-pri
iface br-pri inet static
address 10.10.10.3/24

auto ens5
iface ens5 inet manual

## interface up
ifup br-pri
ifup ens5

vi /etc/neutron/plugins/ml2/ml2_conf.ini
...
flat_networks = public,private
...
network_vlan_ranges = public,private
...
bridge_mappings = public:br-ex,private:br-pri

## bridge service restart
systemctl restart openvswitch-switch.service
systemctl restart devstack@q-*

## compute node 등록
sudo su - stack
./devstack/tools/discover_hosts.sh


******************
** Compute <--> Controller 통신을 위한 브릿지 생성
******************
## Compute node 에서 작업 (root mode)
ovs-vsctl del-br br-ex
ovs-vsctl --may-exist add-br br-pri
ovs-vsctl add-port br-pri ens4

vi /etc/network/interfaces
...
auto br-pri
iface br-pri inet static
address 10.10.10.3/24

auto ens5
iface ens5 inet manual

## interface up
ifup br-pri
ifup ens4

vi /etc/neutron/plugins/ml2/ml2_conf.ini
...
flat_networks = private
...
network_vlan_ranges = private
...
bridge_mappings = private:br-pri

## bridge service restart
systemctl restart openvswitch-switch.service
systemctl restart devstack@q-*