AKS 无法创建工作节点

AKS unable to create Worker Node

尝试创建代理后面的 AKS,AKS 无法在节点池中启动工作节点,因连接超时错误而失败,https://mcr.microsoft.com/ 443

尝试使用以下参数但出现错误 https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster#http_proxy_config

resource "azurerm_kubernetes_cluster" "aks_cluster" {
  name                       = 
  location                   = 
  resource_group_name        = 
  dns_prefix                 = 
  kubernetes_version        = 
  kubernetes_version         = 
  node_resource_group        = 
  private_cluster_enabled    = 
  http_proxy                 = 
  https_proxy                = 
  no_proxy                   = 
╷
│ Error: Unsupported argument
│ 
│   on aks_cluster.tf line 60, in resource "azurerm_kubernetes_cluster" "aks_cluster":
│   60:   http_proxy                 = "export http_proxy=http:"
│ 
│ An argument named "http_proxy" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on aks_cluster.tf line 61, in resource "azurerm_kubernetes_cluster" "aks_cluster":
│   61:   https_proxy                = "export https_proxy=http://"
│ 
│ An argument named "https_proxy" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on aks_cluster.tf line 62, in resource "azurerm_kubernetes_cluster" "aks_cluster":
│   62:   no_proxy                   = "localhost,"
│ 
│ An argument named "no_proxy" is not expected here.
╵
##[error]Terraform command 'validate' failed with exit code

Another one

│   on aks_cluster.tf line 70, in resource "azurerm_kubernetes_cluster" "aks_cluster":
│   70:     http_proxy_config     = "export https_proxy=http:///"
│ 
│ An argument named "http_proxy_config" is not expected here

我做到了:https://docs.microsoft.com/en-us/azure/aks/http-proxy 检查:https://github.com/hashicorp/terraform-provider-azurerm/pull/14177

您必须在 azurerm_kubernetes_cluster 资源块中的 http_proxy_config 块内声明 http_proxyhttps_proxyno_proxy

代码如下:

resource "azurerm_kubernetes_cluster" "example" {
  name                = "ansuman-aks1"
  location            = data.azurerm_resource_group.example.location
  resource_group_name = data.azurerm_resource_group.example.name
  dns_prefix          = "ansumanaks1"

  default_node_pool {
    name       = "default"
    node_count = 1
    vm_size    = "Standard_D2_v2"
  }

  identity {
    type = "SystemAssigned"
  }
http_proxy_config {
    http_proxy                 = "http://myproxy.server.com:8080/"
    https_proxy                = "https://myproxy.server.com:8080/"
    no_proxy                   = ["localhost","127.0.0.1"]
}
}

输出:

注意:请确保您已在订阅中注册 HTTPProxyConfigPreview 功能,并且在注册后您已注册该功能的提供商 Microsoft.ContainerService按照Microsoft Documentation中所述生效。另外请确保您提供了正确的代理API。