Skip to content

Commit

Permalink
aks setup improvements (#2103)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
dzmitry-lahoda authored May 20, 2021
1 parent 3759e8f commit 0c40d58
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
12 changes: 6 additions & 6 deletions install/terraform/modules/aks/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 7 additions & 0 deletions install/terraform/modules/aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
13 changes: 10 additions & 3 deletions site/content/en/docs/Installation/Creating Cluster/aks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 0c40d58

Please sign in to comment.