sigs.k8s.io/cluster-api-provider-azure@v1.17.0/templates/cluster-template-machinepool-windows.yaml (about)

     1  apiVersion: cluster.x-k8s.io/v1beta1
     2  kind: Cluster
     3  metadata:
     4    labels:
     5      cni-windows: calico
     6      csi-proxy: enabled
     7      windows: enabled
     8    name: ${CLUSTER_NAME}
     9    namespace: default
    10  spec:
    11    clusterNetwork:
    12      pods:
    13        cidrBlocks:
    14        - 192.168.0.0/16
    15    controlPlaneRef:
    16      apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    17      kind: KubeadmControlPlane
    18      name: ${CLUSTER_NAME}-control-plane
    19    infrastructureRef:
    20      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    21      kind: AzureCluster
    22      name: ${CLUSTER_NAME}
    23  ---
    24  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    25  kind: AzureCluster
    26  metadata:
    27    name: ${CLUSTER_NAME}
    28    namespace: default
    29  spec:
    30    identityRef:
    31      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    32      kind: AzureClusterIdentity
    33      name: ${CLUSTER_IDENTITY_NAME}
    34    location: ${AZURE_LOCATION}
    35    networkSpec:
    36      subnets:
    37      - name: control-plane-subnet
    38        role: control-plane
    39      - name: node-subnet
    40        role: node
    41      vnet:
    42        name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet}
    43    resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}}
    44    subscriptionID: ${AZURE_SUBSCRIPTION_ID}
    45  ---
    46  apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    47  kind: KubeadmControlPlane
    48  metadata:
    49    name: ${CLUSTER_NAME}-control-plane
    50    namespace: default
    51  spec:
    52    kubeadmConfigSpec:
    53      clusterConfiguration:
    54        apiServer:
    55          extraArgs:
    56            cloud-provider: external
    57          timeoutForControlPlane: 20m
    58        controllerManager:
    59          extraArgs:
    60            allocate-node-cidrs: "false"
    61            cloud-provider: external
    62            cluster-name: ${CLUSTER_NAME}
    63        etcd:
    64          local:
    65            dataDir: /var/lib/etcddisk/etcd
    66            extraArgs:
    67              quota-backend-bytes: "8589934592"
    68      diskSetup:
    69        filesystems:
    70        - device: /dev/disk/azure/scsi1/lun0
    71          extraOpts:
    72          - -E
    73          - lazy_itable_init=1,lazy_journal_init=1
    74          filesystem: ext4
    75          label: etcd_disk
    76        - device: ephemeral0.1
    77          filesystem: ext4
    78          label: ephemeral0
    79          replaceFS: ntfs
    80        partitions:
    81        - device: /dev/disk/azure/scsi1/lun0
    82          layout: true
    83          overwrite: false
    84          tableType: gpt
    85      files:
    86      - contentFrom:
    87          secret:
    88            key: control-plane-azure.json
    89            name: ${CLUSTER_NAME}-control-plane-azure-json
    90        owner: root:root
    91        path: /etc/kubernetes/azure.json
    92        permissions: "0644"
    93      initConfiguration:
    94        nodeRegistration:
    95          kubeletExtraArgs:
    96            cloud-provider: external
    97          name: '{{ ds.meta_data["local_hostname"] }}'
    98      joinConfiguration:
    99        nodeRegistration:
   100          kubeletExtraArgs:
   101            cloud-provider: external
   102          name: '{{ ds.meta_data["local_hostname"] }}'
   103      mounts:
   104      - - LABEL=etcd_disk
   105        - /var/lib/etcddisk
   106      postKubeadmCommands: []
   107      preKubeadmCommands: []
   108    machineTemplate:
   109      infrastructureRef:
   110        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   111        kind: AzureMachineTemplate
   112        name: ${CLUSTER_NAME}-control-plane
   113    replicas: ${CONTROL_PLANE_MACHINE_COUNT:=1}
   114    version: ${KUBERNETES_VERSION}
   115  ---
   116  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   117  kind: AzureMachineTemplate
   118  metadata:
   119    name: ${CLUSTER_NAME}-control-plane
   120    namespace: default
   121  spec:
   122    template:
   123      spec:
   124        dataDisks:
   125        - diskSizeGB: 256
   126          lun: 0
   127          nameSuffix: etcddisk
   128        identity: UserAssigned
   129        osDisk:
   130          diskSizeGB: 128
   131          osType: Linux
   132        sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
   133        userAssignedIdentities:
   134        - providerID: /subscriptions/${AZURE_SUBSCRIPTION_ID}/resourceGroups/${CI_RG:=capz-ci}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/${USER_IDENTITY:=cloud-provider-user-identity}
   135        vmSize: ${AZURE_CONTROL_PLANE_MACHINE_TYPE}
   136  ---
   137  apiVersion: cluster.x-k8s.io/v1beta1
   138  kind: MachinePool
   139  metadata:
   140    name: ${CLUSTER_NAME}-mp-0
   141    namespace: default
   142  spec:
   143    clusterName: ${CLUSTER_NAME}
   144    replicas: ${WORKER_MACHINE_COUNT:=2}
   145    template:
   146      spec:
   147        bootstrap:
   148          configRef:
   149            apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
   150            kind: KubeadmConfig
   151            name: ${CLUSTER_NAME}-mp-0
   152        clusterName: ${CLUSTER_NAME}
   153        infrastructureRef:
   154          apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   155          kind: AzureMachinePool
   156          name: ${CLUSTER_NAME}-mp-0
   157        version: ${KUBERNETES_VERSION}
   158  ---
   159  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   160  kind: AzureMachinePool
   161  metadata:
   162    name: ${CLUSTER_NAME}-mp-0
   163    namespace: default
   164  spec:
   165    location: ${AZURE_LOCATION}
   166    strategy:
   167      rollingUpdate:
   168        deletePolicy: Oldest
   169        maxSurge: 25%
   170        maxUnavailable: 1
   171      type: RollingUpdate
   172    template:
   173      osDisk:
   174        diskSizeGB: 30
   175        managedDisk:
   176          storageAccountType: Premium_LRS
   177        osType: Linux
   178      sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
   179      vmSize: ${AZURE_NODE_MACHINE_TYPE}
   180  ---
   181  apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
   182  kind: KubeadmConfig
   183  metadata:
   184    name: ${CLUSTER_NAME}-mp-0
   185    namespace: default
   186  spec:
   187    files:
   188    - contentFrom:
   189        secret:
   190          key: worker-node-azure.json
   191          name: ${CLUSTER_NAME}-mp-0-azure-json
   192      owner: root:root
   193      path: /etc/kubernetes/azure.json
   194      permissions: "0644"
   195    joinConfiguration:
   196      nodeRegistration:
   197        kubeletExtraArgs:
   198          cloud-provider: external
   199        name: '{{ ds.meta_data["local_hostname"] }}'
   200  ---
   201  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   202  kind: AzureClusterIdentity
   203  metadata:
   204    labels:
   205      clusterctl.cluster.x-k8s.io/move-hierarchy: "true"
   206    name: ${CLUSTER_IDENTITY_NAME}
   207    namespace: default
   208  spec:
   209    allowedNamespaces: {}
   210    clientID: ${AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY}
   211    tenantID: ${AZURE_TENANT_ID}
   212    type: ${CLUSTER_IDENTITY_TYPE:=WorkloadIdentity}
   213  ---
   214  apiVersion: cluster.x-k8s.io/v1beta1
   215  kind: MachinePool
   216  metadata:
   217    name: ${CLUSTER_NAME}-mp-win
   218    namespace: default
   219  spec:
   220    clusterName: ${CLUSTER_NAME}
   221    replicas: ${WORKER_MACHINE_COUNT:=2}
   222    template:
   223      spec:
   224        bootstrap:
   225          configRef:
   226            apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
   227            kind: KubeadmConfig
   228            name: ${CLUSTER_NAME}-mp-win
   229        clusterName: ${CLUSTER_NAME}
   230        infrastructureRef:
   231          apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   232          kind: AzureMachinePool
   233          name: ${CLUSTER_NAME}-mp-win
   234        version: ${KUBERNETES_VERSION}
   235  ---
   236  apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
   237  kind: AzureMachinePool
   238  metadata:
   239    annotations:
   240      runtime: containerd
   241      windowsServerVersion: ${WINDOWS_SERVER_VERSION:=""}
   242    name: ${CLUSTER_NAME}-mp-win
   243    namespace: default
   244  spec:
   245    location: ${AZURE_LOCATION}
   246    template:
   247      osDisk:
   248        diskSizeGB: 128
   249        managedDisk:
   250          storageAccountType: Premium_LRS
   251        osType: Windows
   252      sshPublicKey: ${AZURE_SSH_PUBLIC_KEY_B64:=""}
   253      vmSize: ${AZURE_NODE_MACHINE_TYPE}
   254  ---
   255  apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
   256  kind: KubeadmConfig
   257  metadata:
   258    name: ${CLUSTER_NAME}-mp-win
   259    namespace: default
   260  spec:
   261    files:
   262    - contentFrom:
   263        secret:
   264          key: worker-node-azure.json
   265          name: ${CLUSTER_NAME}-mp-win-azure-json
   266      owner: root:root
   267      path: c:/k/azure.json
   268      permissions: "0644"
   269    - content: Add-MpPreference -ExclusionProcess C:/opt/cni/bin/calico.exe
   270      path: C:/defender-exclude-calico.ps1
   271      permissions: "0744"
   272    joinConfiguration:
   273      nodeRegistration:
   274        criSocket: npipe:////./pipe/containerd-containerd
   275        kubeletExtraArgs:
   276          cloud-provider: external
   277          pod-infra-container-image: mcr.microsoft.com/oss/kubernetes/pause:3.9
   278        name: '{{ ds.meta_data["local_hostname"] }}'
   279    postKubeadmCommands:
   280    - nssm set kubelet start SERVICE_AUTO_START
   281    - powershell C:/defender-exclude-calico.ps1
   282    preKubeadmCommands:
   283    - powershell c:/create-external-network.ps1
   284    users:
   285    - groups: Administrators
   286      name: capi
   287      sshAuthorizedKeys:
   288      - ${AZURE_SSH_PUBLIC_KEY:=""}