Giter Club home page Giter Club logo

Comments (5)

alex-frankel avatar alex-frankel commented on August 18, 2024

Can you share the bicep code you are using to deploy AKS? What happens if you don't use a parameter and hard code the value in the resource declaration?

from bicep-types-az.

ra002890 avatar ra002890 commented on August 18, 2024

Thanks for the prompt answer!
This is the bicep script that I am trying to use.

param location string = resourceGroup().location
param projectName string = 'nsx-${uniqueString(resourceGroup().id)}'
param projectEnv string = 'test'

@description('Specifies the id of the virtual network.')
param virtualNetworkId string

@description('Specifies the name of the default subnet hosting the AKS cluster.')
param aksSubnetName string = 'AksSubnet'

@description('Specifies the CIDR notation IP range from which to assign pod IPs when kubenet is used.')
param aksClusterPodCidr string = '10.244.0.0/16'

@description('A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges.')
param aksClusterServiceCidr string = '10.2.0.0/16'

@description('Specifies the IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr.')
param aksClusterDnsServiceIP string = '10.2.0.10'

var virtualNetworkName = last(split(virtualNetworkId, '/'))

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-08-01' existing = {
  name: virtualNetworkName
}

resource aksSubnet 'Microsoft.Network/virtualNetworks/subnets@2020-08-01' existing = {
  parent: virtualNetwork
  name: aksSubnetName
}

resource networkContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
  name: '4d97b98b-1d4f-4787-a291-c67834d212e7'
  scope: subscription()
}

// AKS Cluster
resource aksCluster 'Microsoft.ContainerService/managedClusters@2024-01-02-preview' = {
  name: 'aks-${projectName}-${projectEnv}'
  location: location
  sku: {
    name: 'Base'
    tier: 'Free'
  }
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    dnsPrefix: 'aks-${projectName}-${projectEnv}-k8s'
    agentPoolProfiles: [
      {
        name: 'agentpool'
        count: 1
        vmSize: 'Standard_B4ms'
        vnetSubnetID: aksSubnet.id
        mode: 'System'
      }
      {
        name: 't4spotpool'
        count: 1
        minCount: 1
        maxCount: 3
        vmSize: 'Standard_NC4as_T4_v3'
        spotMaxPrice: json('0.3')
        mode: 'User'
        vnetSubnetID: aksSubnet.id
        nodeLabels: {
          gpu: 't4'
        }
        nodeTaints: [
          'sku=gpu:NoSchedule'
        ]
        linuxOSConfig: {
          transparentHugePageEnabled: 'madvise'
          transparentHugePageDefrag: 'defer+madvise'
          swapFileSizeMB: 26000
          sysctls: {
            netCoreSomaxconn: 163849
            netIpv4TcpTwReuse: true
            netIpv4IpLocalPortRange: '32000 60000'
          }
        }
        kubeletConfig: {
          cpuManagerPolicy: 'static'
          cpuCfsQuota: true
          cpuCfsQuotaPeriod: '200ms'
          imageGcHighThreshold: 90
          imageGcLowThreshold: 70
          topologyManagerPolicy: 'best-effort'
          allowedUnsafeSysctls: [
            'kernel.msg*'
            'net.*'
          ]
          failSwapOn: false
        }
        upgradeSettings: {
          maxSurge: null
        }
        scaleSetPriority: 'Spot'
        enableAutoScaling: true
      }
    ]
    networkProfile: {
      networkPlugin: 'kubenet'
      podCidr: aksClusterPodCidr
      serviceCidr: aksClusterServiceCidr
      dnsServiceIP: aksClusterDnsServiceIP
    }
  }
  tags: {
    environment: projectEnv
  }
}

// Assign the Network Contributor role to the Application Load Balancer user-assigned managed identity with the association subnet as as scope
resource aksNetworkContributorRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(resourceGroup().name, 'aksManagedEntity', networkContributorRole.id)
  scope: resourceGroup()
  properties: {
    roleDefinitionId: networkContributorRole.id
    principalId: aksCluster.identity.principalId
    principalType: 'ServicePrincipal'
  }
}

from bicep-types-az.

alex-frankel avatar alex-frankel commented on August 18, 2024

Got it - this is more than likely not an issue with Bicep itself. I would recommend opening up a support case so this can be routed to the AKS team. I will also share this with the AKS PG to see if they can help in the meantime.

from bicep-types-az.

matthchr avatar matthchr commented on August 18, 2024

This looks like an AKS validation bug to me. If you set the Type field of the spot AgentPool to be VirtualMachineScaleSets I believe the error will stop.

from bicep-types-az.

matthchr avatar matthchr commented on August 18, 2024

We'll get a fix in so that in the future you don't need this workaround (setting Type).

It won't roll out for a few weeks though

from bicep-types-az.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.