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.

67 lines
2.6 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/cli/azure/install-azure-cli?view=azure-cli-latest)
  8. - [Login with azure-cli](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest)
  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 two variables in group_vars/all. The one is the **cluster_name** variable, it must be globally
  12. unique due to some restrictions in Azure. The other one is the **ssh_public_keys** variable, it must be your ssh public
  13. key to access your azure virtual machines. Most other variables should be self explanatory if you have some basic Kubernetes
  14. experience.
  15. ## Bastion host
  16. You can enable the use of a Bastion Host by changing **use_bastion** in group_vars/all to **true**. The generated
  17. templates will then include an additional bastion VM which can then be used to connect to the masters and nodes. The option
  18. also removes all public IPs from all other VMs.
  19. ## Generating and applying
  20. To generate and apply the templates, call:
  21. ```shell
  22. ./apply-rg.sh <resource_group_name>
  23. ```
  24. If you change something in the configuration (e.g. number of nodes) later, you can call this again and Azure will
  25. take care about creating/modifying whatever is needed.
  26. ## Clearing a resource group
  27. If you need to delete all resources from a resource group, simply call:
  28. ```shell
  29. ./clear-rg.sh <resource_group_name>
  30. ```
  31. **WARNING** this really deletes everything from your resource group, including everything that was later created by you!
  32. ## Installing Ansible and the dependencies
  33. Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
  34. ## Generating an inventory for kubespray
  35. After you have applied the templates, you can generate an inventory with this call:
  36. ```shell
  37. ./generate-inventory.sh <resource_group_name>
  38. ```
  39. It will create the file ./inventory which can then be used with kubespray, e.g.:
  40. ```shell
  41. cd kubespray-root-dir
  42. ansible-playbook -i contrib/azurerm/inventory -u devops --become -e "@inventory/sample/group_vars/all/all.yml" cluster.yml
  43. ```