mirantis/training-lab

Verified Publisher

By Mirantis Inc

Updated about 7 years ago

Docker image for building Mirantis training-lab (https://github.com/Mirantis/training-lab)

Image
Integration & delivery
Operating systems
0

2.2K

mirantis/training-lab repository overview

Training Lab

Build Status

You will need to have Docker installed.

Requirements

Network diagram

  • Training lab - Architecture diagram

Training lab - Architecture diagram

  • Ansible + Terraform + Cloud Architecture

Ansible + Terraform + Cloud Architecture

Network schema
ServiceIP / FQDN
DNS8.8.8.8, 1.1.1.1
NTP0.pool.ntp.org, 1.pool.ntp.org
DescriptionUsagevxlan idCIDRGateway
Management (MGMT)Management, PXE boot new bare metal servers (Salt)1010.0.0.0/2410.0.0.241
Control Plane (Control)MCP internal (Salt, Services, API, SDN)1110.0.1.0/2410.0.1.241
Public (Proxy)Users facing (Web UI, API Endpoints)1210.0.2.0/2410.0.2.241
DataSDN Data plane (optional, recomended)1310.0.3.0/2410.0.3.241
Storage Network (Front-End/Access)SDS Front1410.0.4.0/2410.0.4.241
Storage Network (Back-End/Replication)SDS Replication (optional)1510.0.5.0/2410.0.5.241
Infrastructure overview
Node typeHostnamemgmt network MACFQDNPublic FQDNRole/DescriptionCloud IPManagement IP (br-mgm)Control IP (br-ctl)Public/Proxy IP (br-public)Dataplane IP (br-data)SDS front IP (br-storage)SDS Replication IP (br-storrepl)Type [VM, Nested VM]PlacementRAMHDDCPU
kvm01kvm01???kvm01.tng.mirantis.com???-kvm01.??.tng.mirantis.comMCP Infra192.168.250.24110.0.0.24110.0.1.24110.0.2.24110.0.3.24110.0.4.24110.0.5.241VMnone6412816
kvmkvm02???kvm02.tng.mirantis.com???-kvm02.??.tng.mirantis.comMCP Infra192.168.250.24210.0.0.24210.0.1.24210.0.2.24210.0.3.24210.0.4.24210.0.5.242VMnone6412816
kvmkvm03???kvm03.tng.mirantis.com???-kvm03.??.tng.mirantis.comMCP Infra192.168.250.24310.0.0.24310.0.1.24310.0.2.24310.0.3.24310.0.4.24310.0.5.243VMnone6412816
cfg01cfg03???cfg01.tng.mirantis.comnoneMCP Infranone10.0.0.1510.0.1.15nonenonenonenoneNested VMkvm018504
cmp01cmp01???cmp01.tng.mirantis.comnoneCompute Node (KVM)192.168.250.23110.0.0.23110.0.1.23110.0.2.23110.0.3.23110.0.4.23110.0.5.231VMnone8162
osd01osd01???osd01.tng.mirantis.comnoneCeph OSD node192.168.250.22110.0.0.22110.0.1.22110.0.2.22110.0.3.22110.0.4.22110.0.5.221VMnone4202
pxekvm01-pxe0152:54:00:00:01:01kvm01-pxe01nonePXE MAAS testnoneMAAS DHCPnonenonenonenonenoneNested VMkvm01251
pxekvm02-pxe0152:54:00:00:02:01kvm02-pxe01nonePXE MAAS testnoneMAAS DHCPnonenonenonenonenoneNested VMkvm02251
pxekvm03-pxe0152:54:00:00:03:01kvm03-pxe01nonePXE MAAS testnoneMAAS DHCPnonenonenonenonenoneNested VMkvm03251

Few notes how to build the Training environment in Azure using prebuilded Docker image. Docker image contains az, Terraform + Ansible.

Create Service Principal and authenticate to Azure - this should be done only once for the new Azure accounts:

echo "*** Login to the Azure CLI"
az login

echo "*** Get Subscription ID for Default Subscription"
SUBSCRIPTION_ID=$(az account list | jq -r '.[] | select (.isDefault == true).id')

echo "*** Create the Service Principal which will have permissions to manage resources in the specified Subscription"
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/$SUBSCRIPTION_ID"

echo "*** Login to Azure using Service Principal and check if it is working"
az login --service-principal -u 0xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -p fxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx --tenant 0xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
az vm list-sizes --location westus
Create DNS zone

See the details: https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns

# Create resource group
$ az group create --name training-lab-dns --location "East US 2"
$ az network dns zone create -g training-lab-dns -n tng.mirantis.com

# List DNS nameservers for zone tng.mirantis.com in Azure
# You need to ask the domain owner to delegate the zone "tng.mirantis.com" to the Azure nameservers
$ az network dns zone show -g training-lab-dns -n tng.mirantis.com -o json

# Check if DNS servers are forwarding queries to Azure DNS server
$ dig +short -t SOA tng.mirantis.com
ns1-04.azure-dns.com. azuredns-hostmaster.microsoft.com. 1 3600 300 2419200 300

# Add default "www" CNAME to training.mirantis.com
$ az network dns record-set cname set-record -g training-lab-dns -z tng.mirantis.com -n www -c training.mirantis.com
Create Resource Group holding the images created by packer (optional)

Building own images will speed up the deployment process. Details can be found here: https://www.packer.io/docs/builders/azure-setup.html and https://github.com/hashicorp/packer/blob/master/contrib/azure-setup.sh

# Create resource group
az group create --name training-lab-images --location "East US 2"

echo "*** Create application"
az ad app create --display-name "packerbuild" --identifier-uris http://packerbuild --homepage http://packerbuild --password my_packer_password

# Change password: az ad app update --id $(az ad app list | jq -r '.[] | select (.displayName == "packerbuild").appId') --password fxxxxxxxxxxxxxxf

echo "*** Get application id"
CLIENT_ID=$(az ad app list | jq -r '.[] | select (.displayName == "packerbuild").appId')

echo "*** Create service principal"
az ad sp create --id $CLIENT_ID

echo "*** Get service principal id"
OBJECT_ID=$(az ad sp list | jq -r '.[] | select (.displayName == "packerbuild").objectId')

echo "*** Get Subscription ID for Default Subscription"
SUBSCRIPTION_ID=$(az account list | jq -r '.[] | select (.isDefault == true).id')

echo "*** Create permissions"
az role assignment create --assignee $OBJECT_ID --role "Owner" --scope /subscriptions/$SUBSCRIPTION_ID

Build your own images

The standard deployment process download many packages / huge images / repositories form Internet which takes a lot of time. Build your own images for OpenStack / Azure / local testing to speed up the deployment.

Build azure images
export AZURE_CLIENT_ID="$(az ad app list | jq -r '.[] | select (.displayName == "packerbuild").appId')"
export AZURE_CLIENT_SECRET="my_packer_password"
export AZURE_RESOURCE_GROUP_NAME="training-lab-images"
export AZURE_SUBSCRIPTION_ID="$(az account list | jq -r '.[] | select (.isDefault == true).id')"

NAME=training-lab_kvm-ubuntu-16.04-server-amd64   packer build -only=azure-arm training-lab_ubuntu_image.json
NAME=training-lab_kvm01-ubuntu-16.04-server-amd64 packer build -only=azure-arm training-lab_ubuntu_image.json

Please check the packer directory for more details.

Build environment on Ubuntu

Follow these commands to install necessary requirements on latest Ubuntu:

# You can use docker image:
# docker run -e "USER=$USER" --privileged --rm -it ubuntu:latest

sudo apt update -qq
sudo apt install -y curl docker.io git openssh-client sudo

# Change the default docker networking if needed
cat > /etc/docker/daemon.json << EOF
{
  "bip": "192.168.150.1/24",
  "fixed-cidr": "192.168.150.0/24"
}
EOF

sudo service docker start

test -f $HOME/.ssh/id_rsa || ( install -m 0700 -d $HOME/.ssh && ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_rsa -q -N "" )

git clone https://github.com/Mirantis/training-lab.git

read -s -p "Ansible Vault Password for Training Lab: " MY_ANSIBLE_VAULT_TRAINIG_LAB_PASSWORD
echo "$MY_ANSIBLE_VAULT_TRAINIG_LAB_PASSWORD" > training-lab/ansible/vault_training-lab.txt

cd training-lab/ansible

# Create OpenStack training environment
./create_openstack.sh
# Delete whole OpenStack structure
./delete_openstack.sh

or

# Create Azure training environment
./create_azure.sh
# Delete whole Azure structure
./delete_azure.sh

asciicast

Deployment steps on kvm01

https://docs.mirantis.com/mcp/master/mcp-deployment-guide/single/index.html (Start from: To create control plane VMs:)

# Check the cfg01 console
$ virsh console cfg01.tng.mirantis.com
# or you can ssh to cfg01 once it's installed
$ ssh root@cfg01

# check if installation process finished successfully (it should ends with "reboot")
$ tail -1 /var/log/cloud-init-output.log
+ reboot

# Verify that all your Salt Minion nodes are registered on the Salt Master node
$ salt-key
Accepted Keys:
cfg01.tng.mirantis.com
cmp01.tng.mirantis.com
kvm01.tng.mirantis.com
kvm02.tng.mirantis.com
kvm03.tng.mirantis.com
Denied Keys:
Unaccepted Keys:
Rejected Keys:

# Check salt versions
$ salt '*' test.version
cfg01.tng.mirantis.com:
    2017.7.5
cmp01.tng.mirantis.com:
    2017.7.5
kvm01.tng.mirantis.com:
    2017.7.5
kvm02.tng.mirantis.com:
    2017.7.5
kvm03.tng.mirantis.com:
    2017.7.5

# Verify that the Salt Minion nodes are synchronized by running the following command on the Salt Master node
$ salt '*' saltutil.sync_all

# Check out your inventory to be able to resolve any inconsistencies in your model:
$ reclass-salt --top

# Verify that the following states are successfully applied during the execution of cloud-init:
$ salt-call state.sls linux.system,linux,openssh,salt
$ salt-call state.sls maas.cluster,maas.region,reclass

# Provision MAAS with servers
$ salt-call state.sls maas.machines

#https://github.com/Mirantis/pipeline-library/blob/master/src/com/mirantis/mk/Orchestrate.groovy#L115
$ salt -C 'I@salt:control' state.apply salt.minion
$ salt -C 'I@salt:control' state.apply linux.system
$ salt -C 'I@salt:control' state.apply linux.network
$ salt -C 'I@salt:control' state.apply ntp,rsyslog,libvirt
$ salt -C 'I@salt:control' state.apply salt.control

#https://github.com/Mirantis/pipeline-library/blob/master/src/com/mirantis/mk/Orchestrate.groovy#L174
$ salt -C 'I@salt:control' state.apply glusterfs.server.service
$ salt -C 'I@salt:control' state.apply glusterfs.server.setup
$ salt -C 'I@salt:control' cmd.run gluster peer status; gluster volume status
$ salt -C 'I@salt:control' state.apply glusterfs.client

# Check if cfg01 is configured properly:
$ salt-call state.apply

# Perform the initial Salt configuration
$ salt -C 'I@salt:control' state.apply salt.minion

# Set up the network interfaces and the SSH access
$ salt -C 'I@salt:control' cmd.run 'salt-call state.sls linux.system.user,openssh,linux.network;reboot'

$ salt 'kvm*' state.apply libvirt

Tag summary

Content type

Image

Digest

Size

201.6 MB

Last updated

about 7 years ago

docker pull mirantis/training-lab

This week's pulls

Pulls:

152

Last week