Contributions by: Alka Gupta, Pranay Bakre and Suma Tambe
In this blog, we outline the step by step process to deploy a Docker Host from vRealize Automation(vRA) 7.3 service catalog using a vRA blueprint.
- Download the ‘CentOS7 with Docker’ .
- Run the Cloudclient as shown in Fig. 1.0
- Login to vRA account through cloudclient – CloudClient>vRA login userpass –user ‘vRA username’ –tenant ‘tenant name’ –server ‘vRA server URL’ –password ‘vRA ’
- Next upload the from step 1 into vRA as shown in Fig 2.0.
- Result should be as shown in Fig 2.0 and the “CentOS 7 on vSphere – with Docker- UC14” blueprint should be visible under vRA->Design->Blueprints.
- Create a CentOS7 x64 base OS template in vCenter with VMware Tools installed. Also, make sure that it has the vRA Application Authoring agent installed. Follow the steps in this link to install the agent.
***make sure to run a data collection in vRA under ‘Infrastructure- >Compute resources -> Cluster name – Data Collection’ there is a change in vCenter to sync the changes into VRA.
- Edit the Blueprint and Software components in vRA added in Step 2 as below:
- Go to Design-> Blueprint: Click on “CentOS 7 on vSphere – with Docker- UC14” to edit, as shown in Fig 3.0
- Click on External, as seen in Fig 3.0 and add the network that’s predefined in the vRA network Profiles. i.e. Choose the network profile defined under Infrastructure -> Reservations-> Network Profiles.
- Edit vSphere details – >Click on vSphere Machine as seen in Fig 3.1 to edit the vSphere VM details
- Change the ID and the machine prefix according to your environment.
- Select Action: Clone, Provision workflow: CloneWorkflow
- Select the vSphere template created in Step-3 in ‘Clone from’ field.
- Next adjust the machine resources accordingly.
- To Add storage-> +New and add the storage as needed and save.
- Edit Network tab -> +New to add and choose the predefined network in the network profile.
- ***Optional – Use the Customization Specification Manager – virtualization spec customized for CentOS7.
- Save and Finish to save the changes
- Edit Software Component: Docker for CentOS7:
Go to vRA->Design->Software Components-> “Docker for cent OS7”->Edit-> Actions As shown in Fig 4.0.
Copy the below script under Actions and overwrite the existing action items.
#Install Lib dependencies
yum install -y yum-utils device-mapper-persistent-data lvm2
#Update our packages
yum -y update –skip-broken
yum -y install docker docker-registry –skip-broken
#stop docker service
systemctl stop docker
#enable docker for every reboot
systemctl enable docker
#start the docker service
systemctl start docker
docker run hello-world
- No changes are needed to Software component: “Linux Configuration for CentOS 7”.
5. Check Blueprint Published State:
Go to Design-> Blueprints-> “CentOS 7 on vSphere – with Docker- UC14” and see if it’s in published state. If not select the same and publish it.
- Catalog Management:
Go to Administration> Catalog management-> Services Tab as shown in Fig 5.0
Create New ->name “CentOS 7 on vSphere – with Docker- UC14”-> [add an icon if needed] -> Status change it as Active-> Assign owner to a user or the admin-> [Optional] Assign a support team -> Click OK.
- Catalog Items:
- Go to Catalog Items-> select “CentOS 7 on vSphere – with Docker- UC14” and click on configure.
- Under General tab, edit the Service as “CentOS 7 on vSphere – with Docker- UC14” from the dropdown box.
- Change the status as Active and click OK to save changes.
- Go back to Services in step (6. a)->select the item “CentOS 7 on vSphere – with Docker- UC14” and click on “Manage Catalog Items” on the top panel under Catalog screen click on + icon -> add the Catalogs “CentOS 7 on vSphere – with Docker- UC14 + Docker for cent OS7 + Linux Configuration for CentOS 7” and activate this service.
Go to Entitlement page as seen in Fig 6.0 – Select the + icon and add a New Entitlement by name “CentOS 7 on vSphere – with Docker- UC14”.
- Click on Next > under Items & Approvals->Entitled Services add the service created earlier “CentOS 7 on vSphere – with Docker- UC14”
- Add the entitled Items->CentOS 7 on vSphere – with Docker- UC14.
- Entitled Actions as select all->Finish-> Activate it.
(Make sure the status shows active in the end of all the configuration, if not Activate the Entitlements created in this step)
- VRA – CentOS7 Deployment and configuration
- Go to vRA-> Catalogs Tab as seen in Fig 7.0 – Select the Service Catalog- CentOS 7 on vSphere – with Docker- UC14 – Click Request-> add data as needed under vSphere Machine: CentOS7 as per instances needed and the description details- Click Submit.
- To check the installation status, click on the task in progress under vRA-> Request Tab-> click on view details. Inside the Request details click on “Execution Information” on the top right hand. Should display information as below as in Fig 8.0.
- On successful provisioning: vRA should have successfully deployed CentOS7 VM with Docker engine on vCenter as seen in Fig 9.0. Log in to the OS and run command – docker images – to check if docker engine is successfully deployed.
- Adding provisioned Docker host in vRA Container Management portal:
- Login to the newly created CentOS7 virtual machine on vCenter and run the following steps:
#Stop the Docker Service
systemctl stop docker
#create the customised docker config file
echo -e “[Service] \nExecStart= \nExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock \n ” >> /etc/systemd/system/docker.service.d/docker.conf
#start the docker Service
systemctl start docker
- Check if the port 2375 is open for tcp connections by running the command on the newly deployed # netstat -ntlp.
- Go to Containers tab-> Host menu on the left -> add a Host button-> edit as given below and click on Add button as shown in Fig 10.0. Add the IP of the CentOS7 VM in the Addresses field along with the port number 2375 as shown below
- Docker container is ready to be managed on the Container UI as seen in Fig 11.0.
- Troubleshooting issues:
Listing some of the issues encountered while deployments.
- Certificate error fixing for IAAS handshake during provisioning the request – Try regenerating the IaaS and the vRA certificate under https://vRA.vic.local:5480
- Also in the template rerun the prepare_vRA_template.sh script. And reconfigure. -> create the template -> run the data collection.
- Reservation error: Make sure the resource reservation is sufficient enough for vRA request to be provisioned.
- Reservation error: Check under – vRA admiral->Infrastructure->Reservations->Click on Existing reservation->Add the required reservation policy-> Resources Add the storage reservations as needed.
Ex: No reservation is available to allocate within the group <BusinessGroup>. Total 56 GB of storage was requested.
- Port error while adding to Container management portal:
Make sure the docker host has the ports 2375 / 2376 open for tcp connection. Check this by running – #netstat -ntlp command. This should have the sockets “::2375” or “::2376” or “127.0.0.1:2375” or “127.0.0.1:2376” listed as listening mode.