How to achieve Application Diego Cell Affinity using placement tags
search cancel

How to achieve Application Diego Cell Affinity using placement tags

book

Article ID: 297862

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

This procedure describes a simple way to achieve Application Container Cell Affinity. It can be convenient to isolate one or more Diego Cells during troubleshooting scenarios where an application container is having issues being created due to networking or other transient type issues.


Important Note

  • The changes implemented in this procedure are not permanent. Any changes will be overwritten when BOSH updates or recreates the Diego Cell during an Apply Changes or any other deployment update. 
  • These changes will reserve Diego Cells, which means only applications deployed in specific Organizations with the given placement tag will be deployed on the cell. Any other application currently running on the tagged cell will be moved to a different Cell. This is important because it will limit the amount of resources available to your production applications. Please make sure your environment has enough capacity to remove one or more cells before proceeding with this procedure.
  • This procedure is not recommended for production environments. It should only be used as a temporary troubleshooting step.


Environment

OS: 2.8

Resolution

1. Create a new org and space to work from. If you use an existing org for this procedure, please know apps in your existing org will not run unless there is enough available cells with the custom placement tag.
1. cf create-org mytestorg
2. cf create-space mytestspace -o mytestorg
3. cf target -o mytestorg -s mytestspace
2. Create an isolation segment and assign it to your new org.
1. cf create-isolation-segment mytestcells
2. cf enable-org-isolation mytestorg mytestcells
3. cf set-org-default-isolation-segment mytestorg mytestcells
4. cf set-space-isolation-segment mytestspace mytestcells
3. Choose a Diego Cell you want your app to land on and bosh ssh to that cell. Make the following configuration changes.

Note: this will cause all app containers on this cell to evacuate and deploy on other cells. 

a. Edit file /var/vcap/jobs/rep/config/rep.json and update the placement_tags array. Make sure to use the same name as your isolation segment created in step 2.1.
 
b. Update key placement_tags with the key "mytestcells". When you complete the following command, the output should match your configuration.
cat rep.json | jq .placement_tags
[“mytestcells”]
c. monit restart rep

d. After rep is restated, check to see if the change has taken affect:
cfdot cell-state CELL_ID | jq .PlacementTags
[“mytestcells”]

4. Proceed to push apps under the org mytestorg and space mytestspace. All app instances should land on the cell that has the manually updated placement tag.

5. When testing is completed you can remove these changes by removing the placement tag configured in step 3.2 and restarting the rep process as per step 3.3. Then delete the new org and space.