Bicep 資源定義
fluxConfigurations 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
使用範例
Bicep 範例
部署 Kubernetes Flux 組態的基本範例。
param location string = 'westeurope'
param resourceName string = 'acctest0001'
resource managedCluster 'Microsoft.ContainerService/managedClusters@2023-04-02-preview' = {
name: resourceName
location: location
properties: {
agentPoolProfiles: [
{
count: 1
mode: 'System'
name: 'default'
vmSize: 'Standard_DS2_v2'
}
]
dnsPrefix: resourceName
}
}
resource extension 'Microsoft.KubernetesConfiguration/extensions@2022-11-01' = {
name: resourceName
scope: managedCluster
properties: {
autoUpgradeMinorVersion: true
extensionType: 'microsoft.flux'
}
}
resource fluxConfiguration 'Microsoft.KubernetesConfiguration/fluxConfigurations@2022-03-01' = {
name: resourceName
scope: managedCluster
dependsOn: [
extension
]
properties: {
gitRepository: {
repositoryRef: {
branch: 'branch'
}
syncIntervalInSeconds: 120
timeoutInSeconds: 120
url: 'https://github.com/Azure/arc-k8s-demo'
}
kustomizations: {
applications: {
dependsOn: [
'shared'
]
force: false
path: 'cluster-config/applications'
prune: false
retryIntervalInSeconds: 60
syncIntervalInSeconds: 60
timeoutInSeconds: 600
}
shared: {
force: false
path: 'cluster-config/shared'
prune: false
retryIntervalInSeconds: 60
syncIntervalInSeconds: 60
timeoutInSeconds: 600
}
}
namespace: 'flux-system'
scope: 'cluster'
sourceKind: 'GitRepository'
suspend: false
}
}
Azure 已驗證的模組
下列 Azure 驗證模組 可用來部署此資源類型。
若要建立 Microsoft.KubernetesConfiguration/fluxConfigurations 資源,請將下列 Bicep 新增至範本。
resource symbolicname 'Microsoft.KubernetesConfiguration/fluxConfigurations@2022-01-01-preview' = {
scope: resourceSymbolicName or scope
name: 'string'
properties: {
bucket: {
accessKey: 'string'
bucketName: 'string'
insecure: bool
localAuthRef: 'string'
syncIntervalInSeconds: int
timeoutInSeconds: int
url: 'string'
}
configurationProtectedSettings: {
{customized property}: 'string'
}
gitRepository: {
httpsCACert: 'string'
httpsUser: 'string'
localAuthRef: 'string'
repositoryRef: {
branch: 'string'
commit: 'string'
semver: 'string'
tag: 'string'
}
sshKnownHosts: 'string'
syncIntervalInSeconds: int
timeoutInSeconds: int
url: 'string'
}
kustomizations: {
{customized property}: {
dependsOn: [
{
kustomizationName: 'string'
}
]
force: bool
path: 'string'
prune: bool
retryIntervalInSeconds: int
syncIntervalInSeconds: int
timeoutInSeconds: int
}
}
namespace: 'string'
scope: 'string'
sourceKind: 'string'
suspend: bool
}
}
屬性值
Microsoft.KubernetesConfiguration/fluxConfigurations
BucketDefinition
| 名字 |
描述 |
價值 |
| accessKey |
用來安全地存取 S3 貯體的純文字存取密鑰 |
字串 |
| bucketName (儲存桶名稱) |
要從 flux 組態的 URL 端點同步的貯體名稱。 |
字串 |
| 不安全的 |
指定在從 S3 貯體將數據拼入時,是否要使用不安全的通訊。 |
布爾 (bool) |
| localAuthRef 的 |
Kubernetes 叢集上的本機密碼名稱,以做為驗證密碼,而不是受控或使用者提供的組態秘密。 |
字串 |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集 Git 存放庫來源與遠端的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試將叢集 Git 存放庫來源與遠端協調的時間上限。 |
整數 (int) |
| URL |
要同步處理 flux 組態 S3 貯體之 URL。 |
字串 |
DependsOnDefinition
| 名字 |
描述 |
價值 |
| kustomization名稱 |
要宣告相依性之 kustomization 的名稱 |
字串 |
FluxConfigurationProperties
FluxConfigurationPropertiesConfigurationProtectedSettings
FluxConfigurationPropertiesKustomizations
GitRepository定義
| 名字 |
描述 |
價值 |
| httpsCACert |
Base64 編碼的 HTTPS 證書頒發機構單位內容,用來透過 HTTPS 存取 Git 私人 Git 存放庫 |
字串 |
| HTTPs使用者 |
純文本 HTTPS 使用者名稱,用來透過 HTTPS 存取私人 Git 存放庫 |
字串 |
| localAuthRef 的 |
Kubernetes 叢集上的本機密碼名稱,以做為驗證密碼,而不是受控或使用者提供的組態秘密。 |
字串 |
| repositoryRef |
GitRepository 物件的來源參考。 |
RepositoryRefDefinition |
| sshKnownHosts |
Base64 編碼known_hosts值,其中包含透過 SSH 存取私人 Git 存放庫所需的公用 SSH 金鑰 |
字串 |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集 Git 存放庫來源與遠端的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試將叢集 Git 存放庫來源與遠端協調的時間上限。 |
整數 (int) |
| URL |
要同步處理 flux 組態 Git 存放庫的 URL。 |
字串 |
Kustomization定義
| 名字 |
描述 |
價值 |
| 依賴於 |
指定這個 Kustomization 相依的其他 Kustomization。 在完成所有相依性完成對帳之前,此 Kustomization 將不會協調。 |
DependsOnDefinition[] |
| 力 |
當修補因為不可變的字段變更而失敗時,啟用/停用叢集上的 Kubernetes 資源重新建立。 |
布爾 (bool) |
| 路徑 |
來源參考中要協調叢集的路徑。 |
字串 |
| 剪除 |
啟用/停用這個 Kustomization 所建立 Kubernetes 物件的垃圾收集。 |
布爾 (bool) |
| retryIntervalInSeconds |
在對帳失敗時,重新協調叢集上 Kustomization 的間隔。 |
整數 (int) |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集上 Kustomization 的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試協調叢集上 Kustomization 的最大時間。 |
整數 (int) |
RepositoryRefDefinition
| 名字 |
描述 |
價值 |
| branch |
要簽出的 Git 存放庫分支名稱。 |
字串 |
| 提交 |
要簽出的認可SHA。 此值必須與分支名稱結合,才能有效。 這會優先於 semver。 |
字串 |
| SemVer |
用來比對 git 存放庫卷標的 semver 範圍。 這會優先於標籤。 |
字串 |
| 加標籤 |
要簽出的 Git 存放庫標記名稱。 這會優先於分支。 |
字串 |
ARM 樣本資源定義
fluxConfigurations 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
使用範例
若要建立 Microsoft.KubernetesConfiguration/fluxConfigurations 資源,請將下列 JSON 新增至範本。
{
"type": "Microsoft.KubernetesConfiguration/fluxConfigurations",
"apiVersion": "2022-01-01-preview",
"name": "string",
"properties": {
"bucket": {
"accessKey": "string",
"bucketName": "string",
"insecure": "bool",
"localAuthRef": "string",
"syncIntervalInSeconds": "int",
"timeoutInSeconds": "int",
"url": "string"
},
"configurationProtectedSettings": {
"{customized property}": "string"
},
"gitRepository": {
"httpsCACert": "string",
"httpsUser": "string",
"localAuthRef": "string",
"repositoryRef": {
"branch": "string",
"commit": "string",
"semver": "string",
"tag": "string"
},
"sshKnownHosts": "string",
"syncIntervalInSeconds": "int",
"timeoutInSeconds": "int",
"url": "string"
},
"kustomizations": {
"{customized property}": {
"dependsOn": [
{
"kustomizationName": "string"
}
],
"force": "bool",
"path": "string",
"prune": "bool",
"retryIntervalInSeconds": "int",
"syncIntervalInSeconds": "int",
"timeoutInSeconds": "int"
}
},
"namespace": "string",
"scope": "string",
"sourceKind": "string",
"suspend": "bool"
}
}
屬性值
Microsoft.KubernetesConfiguration/fluxConfigurations
| 名字 |
描述 |
價值 |
| apiVersion |
API 版本 |
“2022-01-01-預覽” |
| 名字 |
資源名稱 |
字串 (必要) |
| 性能 |
用來建立 Flux 設定資源的屬性 |
FluxConfigurationProperties |
| 型別 |
資源類型 |
“Microsoft.KubernetesConfiguration/fluxConfigurations” |
BucketDefinition
| 名字 |
描述 |
價值 |
| accessKey |
用來安全地存取 S3 貯體的純文字存取密鑰 |
字串 |
| bucketName (儲存桶名稱) |
要從 flux 組態的 URL 端點同步的貯體名稱。 |
字串 |
| 不安全的 |
指定在從 S3 貯體將數據拼入時,是否要使用不安全的通訊。 |
布爾 (bool) |
| localAuthRef 的 |
Kubernetes 叢集上的本機密碼名稱,以做為驗證密碼,而不是受控或使用者提供的組態秘密。 |
字串 |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集 Git 存放庫來源與遠端的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試將叢集 Git 存放庫來源與遠端協調的時間上限。 |
整數 (int) |
| URL |
要同步處理 flux 組態 S3 貯體之 URL。 |
字串 |
DependsOnDefinition
| 名字 |
描述 |
價值 |
| kustomization名稱 |
要宣告相依性之 kustomization 的名稱 |
字串 |
FluxConfigurationProperties
FluxConfigurationPropertiesConfigurationProtectedSettings
FluxConfigurationPropertiesKustomizations
GitRepository定義
| 名字 |
描述 |
價值 |
| httpsCACert |
Base64 編碼的 HTTPS 證書頒發機構單位內容,用來透過 HTTPS 存取 Git 私人 Git 存放庫 |
字串 |
| HTTPs使用者 |
純文本 HTTPS 使用者名稱,用來透過 HTTPS 存取私人 Git 存放庫 |
字串 |
| localAuthRef 的 |
Kubernetes 叢集上的本機密碼名稱,以做為驗證密碼,而不是受控或使用者提供的組態秘密。 |
字串 |
| repositoryRef |
GitRepository 物件的來源參考。 |
RepositoryRefDefinition |
| sshKnownHosts |
Base64 編碼known_hosts值,其中包含透過 SSH 存取私人 Git 存放庫所需的公用 SSH 金鑰 |
字串 |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集 Git 存放庫來源與遠端的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試將叢集 Git 存放庫來源與遠端協調的時間上限。 |
整數 (int) |
| URL |
要同步處理 flux 組態 Git 存放庫的 URL。 |
字串 |
Kustomization定義
| 名字 |
描述 |
價值 |
| 依賴於 |
指定這個 Kustomization 相依的其他 Kustomization。 在完成所有相依性完成對帳之前,此 Kustomization 將不會協調。 |
DependsOnDefinition[] |
| 力 |
當修補因為不可變的字段變更而失敗時,啟用/停用叢集上的 Kubernetes 資源重新建立。 |
布爾 (bool) |
| 路徑 |
來源參考中要協調叢集的路徑。 |
字串 |
| 剪除 |
啟用/停用這個 Kustomization 所建立 Kubernetes 物件的垃圾收集。 |
布爾 (bool) |
| retryIntervalInSeconds |
在對帳失敗時,重新協調叢集上 Kustomization 的間隔。 |
整數 (int) |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集上 Kustomization 的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試協調叢集上 Kustomization 的最大時間。 |
整數 (int) |
RepositoryRefDefinition
| 名字 |
描述 |
價值 |
| branch |
要簽出的 Git 存放庫分支名稱。 |
字串 |
| 提交 |
要簽出的認可SHA。 此值必須與分支名稱結合,才能有效。 這會優先於 semver。 |
字串 |
| SemVer |
用來比對 git 存放庫卷標的 semver 範圍。 這會優先於標籤。 |
字串 |
| 加標籤 |
要簽出的 Git 存放庫標記名稱。 這會優先於分支。 |
字串 |
fluxConfigurations 資源類型可以使用目標作業來部署:
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
使用範例
部署 Kubernetes Flux 組態的基本範例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "managedCluster" {
type = "Microsoft.ContainerService/managedClusters@2023-04-02-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
identity {
type = "SystemAssigned"
identity_ids = []
}
body = {
properties = {
agentPoolProfiles = [
{
count = 1
mode = "System"
name = "default"
vmSize = "Standard_DS2_v2"
},
]
dnsPrefix = var.resource_name
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "extension" {
type = "Microsoft.KubernetesConfiguration/extensions@2022-11-01"
parent_id = azapi_resource.managedCluster.id
name = var.resource_name
body = {
properties = {
autoUpgradeMinorVersion = true
extensionType = "microsoft.flux"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "fluxConfiguration" {
type = "Microsoft.KubernetesConfiguration/fluxConfigurations@2022-03-01"
name = var.resource_name
parent_id = azapi_resource.managedCluster.id
body = {
properties = {
scope = "cluster"
namespace = "flux-system"
sourceKind = "GitRepository"
suspend = false
gitRepository = {
url = "https://github.com/Azure/arc-k8s-demo"
timeoutInSeconds = 120
syncIntervalInSeconds = 120
repositoryRef = {
branch = "branch"
}
}
kustomizations = {
shared = {
path = "cluster-config/shared"
timeoutInSeconds = 600
syncIntervalInSeconds = 60
retryIntervalInSeconds = 60
prune = false
force = false
}
applications = {
path = "cluster-config/applications"
dependsOn = ["shared"]
timeoutInSeconds = 600
syncIntervalInSeconds = 60
retryIntervalInSeconds = 60
prune = false
force = false
}
}
}
}
depends_on = [
azapi_resource.extension
]
}
若要建立 Microsoft.KubernetesConfiguration/fluxConfigurations 資源,請將下列 Terraform 新增至您的範本。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.KubernetesConfiguration/fluxConfigurations@2022-01-01-preview"
name = "string"
parent_id = "string"
body = {
properties = {
bucket = {
accessKey = "string"
bucketName = "string"
insecure = bool
localAuthRef = "string"
syncIntervalInSeconds = int
timeoutInSeconds = int
url = "string"
}
configurationProtectedSettings = {
{customized property} = "string"
}
gitRepository = {
httpsCACert = "string"
httpsUser = "string"
localAuthRef = "string"
repositoryRef = {
branch = "string"
commit = "string"
semver = "string"
tag = "string"
}
sshKnownHosts = "string"
syncIntervalInSeconds = int
timeoutInSeconds = int
url = "string"
}
kustomizations = {
{customized property} = {
dependsOn = [
{
kustomizationName = "string"
}
]
force = bool
path = "string"
prune = bool
retryIntervalInSeconds = int
syncIntervalInSeconds = int
timeoutInSeconds = int
}
}
namespace = "string"
scope = "string"
sourceKind = "string"
suspend = bool
}
}
}
屬性值
Microsoft.KubernetesConfiguration/fluxConfigurations
| 名字 |
描述 |
價值 |
| 名字 |
資源名稱 |
字串 (必要) |
| 父項識別碼 |
要套用此延伸模組資源之資源的標識碼。 |
字串 (必要) |
| 性能 |
用來建立 Flux 設定資源的屬性 |
FluxConfigurationProperties |
| 型別 |
資源類型 |
“Microsoft.KubernetesConfiguration/fluxConfigurations@2022-01-01-preview” |
BucketDefinition
| 名字 |
描述 |
價值 |
| accessKey |
用來安全地存取 S3 貯體的純文字存取密鑰 |
字串 |
| bucketName (儲存桶名稱) |
要從 flux 組態的 URL 端點同步的貯體名稱。 |
字串 |
| 不安全的 |
指定在從 S3 貯體將數據拼入時,是否要使用不安全的通訊。 |
布爾 (bool) |
| localAuthRef 的 |
Kubernetes 叢集上的本機密碼名稱,以做為驗證密碼,而不是受控或使用者提供的組態秘密。 |
字串 |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集 Git 存放庫來源與遠端的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試將叢集 Git 存放庫來源與遠端協調的時間上限。 |
整數 (int) |
| URL |
要同步處理 flux 組態 S3 貯體之 URL。 |
字串 |
DependsOnDefinition
| 名字 |
描述 |
價值 |
| kustomization名稱 |
要宣告相依性之 kustomization 的名稱 |
字串 |
FluxConfigurationProperties
FluxConfigurationPropertiesConfigurationProtectedSettings
FluxConfigurationPropertiesKustomizations
GitRepository定義
| 名字 |
描述 |
價值 |
| httpsCACert |
Base64 編碼的 HTTPS 證書頒發機構單位內容,用來透過 HTTPS 存取 Git 私人 Git 存放庫 |
字串 |
| HTTPs使用者 |
純文本 HTTPS 使用者名稱,用來透過 HTTPS 存取私人 Git 存放庫 |
字串 |
| localAuthRef 的 |
Kubernetes 叢集上的本機密碼名稱,以做為驗證密碼,而不是受控或使用者提供的組態秘密。 |
字串 |
| repositoryRef |
GitRepository 物件的來源參考。 |
RepositoryRefDefinition |
| sshKnownHosts |
Base64 編碼known_hosts值,其中包含透過 SSH 存取私人 Git 存放庫所需的公用 SSH 金鑰 |
字串 |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集 Git 存放庫來源與遠端的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試將叢集 Git 存放庫來源與遠端協調的時間上限。 |
整數 (int) |
| URL |
要同步處理 flux 組態 Git 存放庫的 URL。 |
字串 |
Kustomization定義
| 名字 |
描述 |
價值 |
| 依賴於 |
指定這個 Kustomization 相依的其他 Kustomization。 在完成所有相依性完成對帳之前,此 Kustomization 將不會協調。 |
DependsOnDefinition[] |
| 力 |
當修補因為不可變的字段變更而失敗時,啟用/停用叢集上的 Kubernetes 資源重新建立。 |
布爾 (bool) |
| 路徑 |
來源參考中要協調叢集的路徑。 |
字串 |
| 剪除 |
啟用/停用這個 Kustomization 所建立 Kubernetes 物件的垃圾收集。 |
布爾 (bool) |
| retryIntervalInSeconds |
在對帳失敗時,重新協調叢集上 Kustomization 的間隔。 |
整數 (int) |
| syncIntervalInSeconds (同步間隔秒) |
重新協調叢集上 Kustomization 的間隔。 |
整數 (int) |
| timeoutInSeconds |
嘗試協調叢集上 Kustomization 的最大時間。 |
整數 (int) |
RepositoryRefDefinition
| 名字 |
描述 |
價值 |
| branch |
要簽出的 Git 存放庫分支名稱。 |
字串 |
| 提交 |
要簽出的認可SHA。 此值必須與分支名稱結合,才能有效。 這會優先於 semver。 |
字串 |
| SemVer |
用來比對 git 存放庫卷標的 semver 範圍。 這會優先於標籤。 |
字串 |
| 加標籤 |
要簽出的 Git 存放庫標記名稱。 這會優先於分支。 |
字串 |