You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.3 KiB

  1. # Kubernetes on Azure with Azure Resource Group Templates
  2. Provision the base infrastructure for a Kubernetes cluster by using [Azure Resource Group Templates](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authoring-templates)
  3. ## Status
  4. This will provision the base infrastructure (vnet, vms, nics, ips, ...) needed for Kubernetes in Azure into the specified
  5. Resource Group. It will not install Kubernetes itself, this has to be done in a later step by yourself (using kubespray of course).
  6. ## Requirements
  7. - [Install azure-cli](https://docs.microsoft.com/en-us/azure/xplat-cli-install)
  8. - [Login with azure-cli](https://docs.microsoft.com/en-us/azure/xplat-cli-connect)
  9. - Dedicated Resource Group created in the Azure Portal or through azure-cli
  10. ## Configuration through group_vars/all
  11. You have to modify at least one variable in group_vars/all, which is the **cluster_name** variable. It must be globally
  12. unique due to some restrictions in Azure. Most other variables should be self explanatory if you have some basic Kubernetes
  13. experience.
  14. ## Bastion host
  15. You can enable the use of a Bastion Host by changing **use_bastion** in group_vars/all to **true**. The generated
  16. templates will then include an additional bastion VM which can then be used to connect to the masters and nodes. The option
  17. also removes all public IPs from all other VMs.
  18. ## Generating and applying
  19. To generate and apply the templates, call:
  20. ```shell
  21. $ ./apply-rg.sh <resource_group_name>
  22. ```
  23. If you change something in the configuration (e.g. number of nodes) later, you can call this again and Azure will
  24. take care about creating/modifying whatever is needed.
  25. ## Clearing a resource group
  26. If you need to delete all resources from a resource group, simply call:
  27. ```shell
  28. $ ./clear-rg.sh <resource_group_name>
  29. ```
  30. **WARNING** this really deletes everything from your resource group, including everything that was later created by you!
  31. ## Generating an inventory for kubespray
  32. After you have applied the templates, you can generate an inventory with this call:
  33. ```shell
  34. $ ./generate-inventory.sh <resource_group_name>
  35. ```
  36. It will create the file ./inventory which can then be used with kubespray, e.g.:
  37. ```shell
  38. $ cd kubespray-root-dir
  39. $ ansible-playbook -i contrib/azurerm/inventory -u devops --become -e "@inventory/group_vars/all.yml" cluster.yml
  40. ```