Multiple subnets for one VNET to build AZURE TKG 1.5.4 clusters
search cancel

Multiple subnets for one VNET to build AZURE TKG 1.5.4 clusters

book

Article ID: 337410

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid

Issue/Introduction

Symptoms:
Building an AZURE TKG cluster on version 1.5.4 cannot be completed when having mulitiple VNET adress spaces (one for control-plane and one for workers) that are not part of the same CIDR.
Reporting the below error fromTanzu CLI 
 spec.networkSpec.subnets[1].cidrBlocks: Invalid value: \"XX.XX.XX.XX/XX\": subnet CIDR not in vnet address space: [XX.XX.XX.XX/XX]

Environment

VMware Tanzu Kubernetes Grid 1.x

Cause

It is not allowed to config multiple VNET CIDRs in Tanzu cli config file.

Resolution

This issue will be fixed in the future TKG release with clusterClass support

Workaround:

Please use this overlay instead:

#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#
#@overlay/match by=overlay.subset({"kind":"AzureCluster"}})
---
kind: AzureCluster
metadata:
  name: #@ data.values.CLUSTER_NAME
spec:
  networkSpec:
    vnet:
      cidrBlocks:
      #@overlay/append
      - #@ data.values.AZURE_VNET_CIDR_2 

 

then follow these steps https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.6/vmware-tanzu-kubernetes-grid-16/GUID-tanzu-k8s-clusters-config-plans.html#node-labels-via-config-variable-12 to define a custom variable named AZURE_VNET_CIDR_2