Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ARM Wrestling, with the Elastic Stack

ARM Wrestling, with the Elastic Stack

Azure Sydney user group presentation on building out an ARM template for deploying Elasticsearch and Kibana to Azure.

Russ Cam

July 18, 2017
Tweet

More Decks by Russ Cam

Other Decks in Technology

Transcript

  1. 5 The Elastic Stack Elastic Cloud Security X-Pack Kibana User

    Interface Elasticsearch Store, Index, & Analyze Ingest Logstash Beats + Alerting Monitoring Graph ML
  2. 9 Marketplace UI { "handler": "Microsoft.Compute.Multi Vm", "version": "0.1.0- preview",

    "parameters": { "basics": [], "steps": [], "outputs": {} } }
  3. 11 Marketplace UI Issues • Only deploy into new Resource

    Group • Cross property validation • Available elements • No Integrated Contact Details
  4. 12 Azure Resource Manager • Consistent API to provision resources

    ‒ Resource Provider Namespaces ‒ Microsoft.Storage ‒ Microsoft.Compute ‒ Microsoft.Network • Resource Groups ‒ Resources deployed into one Resource Group ‒ Resources can exist in different regions RESOURCE GROUP
  5. 14 Declarative Deployment with templates ": "https://../deploymentTemplate.json#", ": "1.0.0.0", "resources":

    [{ "name" "my-vnet" "type" "Microsoft.Network/virtualNetworks" "location" "australiasoutheast" "apiVersion" "2015-06-15" "properties": { "addressSpace": { "addressPrefixes": ["192.168.0.0/16"] } } }]
  6. 17 Deployments • Transactional(-ish) ‒ Deployment succeeds or fails in

    its entirety ‒ No rollback of resources created before point of failure • Deployment modes ‒ Incremental ‒ Complete
  7. 20 Publisher Portal Issues • Approval for Production ‒ Sometimes

    days, sometimes weeks • Different Best Practices ‒ Quickstart Templates vs. Marketplace Templates • Communication ‒ Ubuntu base image removed from Azure in some regions ‒ Existing resource selector removed from Marketplace
  8. 24 Variables and Functions "variables": { "vnetname" : "[concat(parameters('vprefix'), '-',

    uniqueString(resourceGroup().id, deployment().name))]" }, "[variables('vnetname')]"
  9. 25 Linked Templates "variables": "resources": [{ "name": "create-network", "type": "Microsoft.Resources/deployments",

    "apiVersion": "2016-02-01", "properties": { "mode": "incremental", "templateLink": { "uri": "linked-templates/create-network.json" }, "parameters": {}, }],
  10. 26 Outputs "variables": {}, "resources": [], "outputs": { "fqdn": {

    "value": "[concat('http://', reference(resourceId('Microsoft.Network/publicIPAddresses', 'es-external-lb-ip'),providers('Microsoft.Network', 'publicIPAddresses').apiVersions[0]).dnsSettings.fqdn, ':9200')]", "type": "string" } }
  11. 27 Outputs • Reference outputs in outer templates "[reference('create-network').outputs.fqdn.value]" •

    Resources themselves have outputs "[reference('<resource-id>', '<api-version>').<value>]"
  12. 29 Branching "parameters": { "userinput" : { "type" : "string",

    "allowedValues" : ["option1","option2"] } }, "variables": { "options" : { "option1" : { "addressPrefixes": ["192.168.0.0/16"] }, "option2" : { "addressPrefixes": ["10.0.0.0/24"] }, }, "option" : "[variables('options')[parameters('userinput')]]" }, "[variables('option')]"
  13. 30 Choosing Linked Templates "parameters": { "vNet" : { "type"

    : "string", "allowedValues" : ["new","existing"] } } "variables": { "networkTemplateOptions" : { "new" : "nested/new-network.json", "existing" : "nested/existing-network.json" }, "networkTemplate" : "[variables('networkTemplateOptions')[parameters('vNet')]]" }, "templateLink": { "uri" : "[variables('networkTemplate')]" }
  14. 34 To bake or not to bake Using VM Extensions

    ✔ Faster Deployments ✔ Attaching disks to VMs is very fast ✘ Require baking for each version ✘ Upload to Azure ✘ Certification Process ✔ Faster Updates ✔ Leverage VM images available ✔ Adding new features a breeze ✘ Slower Deployments ✘ Desired State Configuration on each deploy
  15. 35 Custom Script VM Extension "publisher" "Microsoft.OSTCExtensions" "type" "CustomScriptForLinux" "settings":

    { "fileUris": "[concat(variables('templateBaseUrl'), 'scripts/elastic-install.sh')] }, "protectedSettings": { "commandToExecute": "bash elastic-install.sh" }
  16. 36 "Managing" waagent Scripts need to be Idempotent Package Manager

    Failures Custom Script VM Extension Issues
  17. 39 ARM Template Issues • Imperatively Declarative • Preflight Validation

    Checks • Manual Mapping • Still missing functions ‒ Max of two integers (now exists, but other useful ones missing) [div(add(add(a,b),(int(replace(string(sub(a,b)), "-", "")))), 2)]
  18. 42 Logging • Default built in log periodically flushes ‒

    Duplicate log messages ‒ Out of order log messages • Custom Log function ‒ Order log messages with execution timestamp ‒ Easily see where failure occurs ‒ Diagnose slowest parts In-built and bespoke
  19. 44 Automated Testing • azure group template validate • UI

    Definition Outputs === ARM Template Inputs • azure group deployment create • CasperJS with Phantom • msportalfx-test ‒ https://www.npmjs.com/package/msportalfx-test
  20. 46 Elastic Stack Options ✔ Managed by Elastic ✔ Upgrades

    and Scaling ✔ Commercial Plugins ✔ Dedicated SLA based Support ✔ Automatic Backups ✘ Not on Azure…yet ✔ Customizable ✔ Automatable ✔ Reproducible ✔ Data Locality ✘ Management ✘ Administration ✔ Easy onboarding ✔ Discoverable through Azure Portal ✔ Contact Details ✘ Proof of Concepts ✘ Limited Features ✘ Updated
  21. 47 Resources • ARM template ‒ https://github.com/elastic/azure-marketplace • ARM template

    example scenarios ‒ https://github.com/elastic/azure-marketplace-examples • Elastic ‒ https://elastic.co