Skip to content

Commit

Permalink
Adding metric alerts to AKS bicep (#66)
Browse files Browse the repository at this point in the history
Metric Alerts
Ascii Art
More Parameter metadata
Role assignment naming consistency
MonitoringMetricsPublisherRole used for Fast Alerting in bicep.
  • Loading branch information
Gordon Byers authored Oct 4, 2021
1 parent 7771146 commit 24726c0
Show file tree
Hide file tree
Showing 8 changed files with 1,915 additions and 79 deletions.
752 changes: 752 additions & 0 deletions bicep/aksmetricalerts.bicep

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bicep/aksnetcontrib.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource uai 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' exist
}

resource existing_vnet_cont 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
name: '${guid(user_identity_principalId, existingAksSubnetName)}'
name: '${guid(user_identity_principalId, existingAksSubnetName)}'
scope: existingAksSubnet
properties: {
roleDefinitionId: networkContributorRole
Expand Down
3 changes: 3 additions & 0 deletions bicep/calcAzFwIp.bicep
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// As per https://github.com/Azure/bicep/issues/2189#issuecomment-815962675 this file is being used as a UDF
// Takes a subnet range and returns the AzFirewall private Ip address

@description('A subnet address for the Azure Firewall')
param vnetFirewallSubnetAddressPrefix string

var subnetOctets = split(vnetFirewallSubnetAddressPrefix,'.')
Expand Down
1,017 changes: 985 additions & 32 deletions bicep/compiled/main.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bicep/dnsZone.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource privateDns 'Microsoft.Network/privateDnsZones@2020-06-01' existing = if
var DNSZoneContributor = resourceId('Microsoft.Authorization/roleDefinitions', 'befefa01-2a29-4197-83a8-272ff33ce314')
resource dnsContributor 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = if (!isPrivate) {
scope: dns
name: guid(resourceGroup().id, principalId)
name: guid(resourceGroup().id, principalId, DNSZoneContributor)
properties: {
roleDefinitionId: DNSZoneContributor
principalType: 'ServicePrincipal'
Expand All @@ -25,7 +25,7 @@ resource dnsContributor 'Microsoft.Authorization/roleAssignments@2020-04-01-prev
var PrivateDNSZoneContributor = resourceId('Microsoft.Authorization/roleDefinitions', 'b12aa53e-6015-4669-85d0-8515ebb3ae7f')
resource privateDnsContributor 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = if (isPrivate) {
scope: privateDns
name: guid(resourceGroup().id, principalId)
name: guid(resourceGroup().id, principalId, PrivateDNSZoneContributor)
properties: {
roleDefinitionId: PrivateDNSZoneContributor
principalType: 'ServicePrincipal'
Expand Down
203 changes: 171 additions & 32 deletions bicep/main.bicep

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions bicep/network.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,3 @@ resource aks_vnet_cont 'Microsoft.Network/virtualNetworks/subnets/providers/role
principalType: 'ServicePrincipal'
}
}

/*
resource aks_vnet_cont 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = if (!empty(aksPrincipleId)) {
scope: existingAKSSubnet
name: guid(resourceGroup().id, aksPrincipleId)
properties: {
roleDefinitionId: networkContributorRole
principalId: aksPrincipleId
principalType: 'ServicePrincipal'
}
}
*/
1 change: 1 addition & 0 deletions referencearchs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ When the AKS Baseline is updated, changes are evaluated and rolled into this pro
1. Networking. Hub/Spoke networks typically already exist, and tightly bundling with Kubernetes doesn't work well here. BYO subnets are supported.
1. AppGw Public Listener. AppGw is the WAF ingress point for inbound internet traffic, however private listeners are also valid for fully private environments.
1. Cluster SLA. Is defaulted to off in interests of a more cost optimised default configuration, a parameter can be provided to opt in for the paid SLA.
1. Monitoring Alerts. Parametrised metric analysis frequency, created two presets (1 as per baseline, 2 less frequent), set default to be much less frequent. Added extra monitoring alerts as per in-cluster suggestions.

0 comments on commit 24726c0

Please sign in to comment.