c12s-kubespray/contrib/azurerm
Cristian Calin 7516fe142f
Move to Ansible 3.4.0 (#7672)
* Ansible: move to Ansible 3.4.0 which uses ansible-base 2.10.10

* Docs: add a note about ansible upgrade post 2.9.x

* CI: ensure ansible is removed before ansible 3.x is installed to avoid pip failures

* Ansible: use newer ansible-lint

* Fix ansible-lint 5.0.11 found issues

* syntax issues
* risky-file-permissions
* var-naming
* role-name
* molecule tests

* Mitogen: use 0.3.0rc1 which adds support for ansible 2.10+

* Pin ansible-base to 2.10.11 to get package fix on RHEL8
2021-07-12 00:00:47 -07:00
..
group_vars clean up document (#5214) 2019-10-02 04:41:07 -07:00
roles Move to Ansible 3.4.0 (#7672) 2021-07-12 00:00:47 -07:00
.gitignore Add Azure Resource Manager templates to contrib folder 2016-12-13 15:37:04 +01:00
apply-rg.sh Azure: Rename apply-rg_2.sh to apply-rg.sh (#6049) 2020-05-03 12:42:26 -07:00
clear-rg.sh Azure: Rename apply-rg_2.sh to apply-rg.sh (#6049) 2020-05-03 12:42:26 -07:00
generate-inventory.sh fix issues with if condition (#1537) 2017-08-20 13:55:13 +03:00
generate-inventory.yml Add Azure Resource Manager templates to contrib folder 2016-12-13 15:37:04 +01:00
generate-inventory_2.yml update azure contrib to use azure cli 2.0 2017-08-11 20:13:02 +02:00
generate-templates.yml Add Azure Resource Manager templates to contrib folder 2016-12-13 15:37:04 +01:00
README.md Improve markdownlint coverage (#7075) 2020-12-22 04:44:26 -08:00

Kubernetes on Azure with Azure Resource Group Templates

Provision the base infrastructure for a Kubernetes cluster by using Azure Resource Group Templates

Status

This will provision the base infrastructure (vnet, vms, nics, ips, ...) needed for Kubernetes in Azure into the specified Resource Group. It will not install Kubernetes itself, this has to be done in a later step by yourself (using kubespray of course).

Requirements

Configuration through group_vars/all

You have to modify at least two variables in group_vars/all. The one is the cluster_name variable, it must be globally unique due to some restrictions in Azure. The other one is the ssh_public_keys variable, it must be your ssh public key to access your azure virtual machines. Most other variables should be self explanatory if you have some basic Kubernetes experience.

Bastion host

You can enable the use of a Bastion Host by changing use_bastion in group_vars/all to true. The generated templates will then include an additional bastion VM which can then be used to connect to the masters and nodes. The option also removes all public IPs from all other VMs.

Generating and applying

To generate and apply the templates, call:

./apply-rg.sh <resource_group_name>

If you change something in the configuration (e.g. number of nodes) later, you can call this again and Azure will take care about creating/modifying whatever is needed.

Clearing a resource group

If you need to delete all resources from a resource group, simply call:

./clear-rg.sh <resource_group_name>

WARNING this really deletes everything from your resource group, including everything that was later created by you!

Generating an inventory for kubespray

After you have applied the templates, you can generate an inventory with this call:

./generate-inventory.sh <resource_group_name>

It will create the file ./inventory which can then be used with kubespray, e.g.:

cd kubespray-root-dir
sudo pip3 install -r requirements.txt
ansible-playbook -i contrib/azurerm/inventory -u devops --become -e "@inventory/sample/group_vars/all/all.yml" cluster.yml