From 0c40d5801b3a8977ebfe8bab72dbac8bcc21a5d8 Mon Sep 17 00:00:00 2001 From: Dzmitry Lahoda Date: Fri, 21 May 2021 00:24:59 +0300 Subject: [PATCH] aks setup improvements (#2103) # md - go plugin to aks is 2 years old, it does not works (error) and MS have done that stuff into cluster, so removed. the person who did plugin working in Playfab - so put public IP into console and documented how to reach it # tf - made public IP variable (default true) - tf validate fmt passed --- install/terraform/modules/aks/aks.tf | 12 ++++++------ install/terraform/modules/aks/variables.tf | 7 +++++++ .../en/docs/Installation/Creating Cluster/aks.md | 13 ++++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/install/terraform/modules/aks/aks.tf b/install/terraform/modules/aks/aks.tf index d2d4b85952..81ccdbe9ea 100644 --- a/install/terraform/modules/aks/aks.tf +++ b/install/terraform/modules/aks/aks.tf @@ -63,12 +63,12 @@ resource "azurerm_kubernetes_cluster" "agones" { kubernetes_version = "1.18.14" default_node_pool { - name = "default" - node_count = var.node_count - vm_size = var.machine_type - os_disk_size_gb = var.disk_size - enable_auto_scaling = false - #enable_node_public_ip = true + name = "default" + node_count = var.node_count + vm_size = var.machine_type + os_disk_size_gb = var.disk_size + enable_auto_scaling = false + enable_node_public_ip = var.enable_node_public_ip #vnet_subnet_id = azurerm_subnet.aks.id } diff --git a/install/terraform/modules/aks/variables.tf b/install/terraform/modules/aks/variables.tf index 23fc744370..345dfceb9d 100644 --- a/install/terraform/modules/aks/variables.tf +++ b/install/terraform/modules/aks/variables.tf @@ -33,3 +33,10 @@ variable "client_id" { variable "client_secret" { } + +# VMSS is used, so it is unpredictable how NICs will be given to VMs +# So let Azure to create NICs with Public IPs as gameservers require +# Azure Managment SDK can be used to obtain these IPs and map Agones GameServers internal IPs to public +variable enable_node_public_ip { + default = true +} \ No newline at end of file diff --git a/site/content/en/docs/Installation/Creating Cluster/aks.md b/site/content/en/docs/Installation/Creating Cluster/aks.md index 92fa399f2e..ac9945934f 100644 --- a/site/content/en/docs/Installation/Creating Cluster/aks.md +++ b/site/content/en/docs/Installation/Creating Cluster/aks.md @@ -29,7 +29,7 @@ az group create --name $AKS_RESOURCE_GROUP --location $AKS_LOCATION # Create the AKS cluster - this might take some time. Type 'az aks create -h' to see all available options # The following command will create a four Node AKS cluster. Node size is Standard A1 v1 and Kubernetes version is {{% k8s-version %}}.{{% aks-k8s-minor-version %}}. Plus, SSH keys will be generated for you, use --ssh-key-value to provide your values -az aks create --resource-group $AKS_RESOURCE_GROUP --name $AKS_NAME --node-count 4 --generate-ssh-keys --node-vm-size Standard_A4_v2 --kubernetes-version {{% k8s-version %}}.{{% aks-k8s-minor-version %}} +az aks create --resource-group $AKS_RESOURCE_GROUP --name $AKS_NAME --node-count 4 --generate-ssh-keys --node-vm-size Standard_A4_v2 --kubernetes-version {{% k8s-version %}}.{{% aks-k8s-minor-version %}} --enable-node-public-ip # Install kubectl sudo az aks install-cli @@ -65,9 +65,16 @@ az network nsg rule create \ --destination-port-range 7000-8000 ``` -### Creating and assigning Public IPs to Nodes +### Getting Public IPs to Nodes -Nodes in AKS don't get a Public IP by default. To assign a Public IP to a Node, find the Resource Group where the AKS resources are installed on the [portal](https://portal.azure.com) (it should have a name like `MC_resourceGroupName_AKSName_westeurope`). Then, you can follow the instructions [here](https://docs.microsoft.com/en-us/azure/site-recovery/concepts-public-ip-address-with-site-recovery) to create a new Public IP and assign it to the Node/VM. For more information on Public IPs for VM NICs, see [this document](https://docs.microsoft.com/azure/virtual-network/virtual-network-network-interface-addresses). If you are looking for an automated way to create and assign Public IPs for your AKS Nodes, check [this project](https://github.com/dgkanatsios/AksNodePublicIPController). + + +To find a resource's public IP, search for [Virtual Machine Scale Sets](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Compute%2FvirtualMachineScaleSets) -> click on the set name(inside `MC_resourceGroupName_AKSName_westeurope` group) -> click `Instances` -> click on the instance name -> view `Public IP address`. + +To get public IP via API [look here](https://github.com/Azure/azure-libraries-for-net/issues/1185#issuecomment-747919226). + + +For more information on Public IPs for VM NICs, see [this document](https://docs.microsoft.com/azure/virtual-network/virtual-network-network-interface-addresses). ## Next Steps