2021-10-15

Step 0: collect the required information in TMC

root@photon-machine [ ~ ]# tmc managementcluster list
  NAME             LABELS        
  attached                       
  aws-hosted                     
  mj-vmc-mgmt-cl   location:vmc  
  dzhang-m16-mgmt                
root@photon-machine [ ~ ]#
root@photon-machine [ ~ ]# tmc cluster list
  NAME        MANAGEMENTCLUSTER  PROVISIONER  LABELS                                
  prod01-c01  dzhang-m16-mgmt    prod01       tmc.cloud.vmware.com/creator:zhangda

root@photon-machine [ ~ ]# tmc clustergroup list
  NAME         LABELS             
  default                         
  ref-arch     team:psa-ref-arch  
  vmc-cluster                     
root@photon-machine [ ~ ]#

root@photon-machine [ ~ ]# tmc managementcluster provisioner list
  NAME    LABELS                              
  dev01   kubernetes.io/metadata.name:dev01   
          vSphereClusterID:domain-c61         
  prod01  kubernetes.io/metadata.name:prod01  
          vSphereClusterID:domain-c61

Step 1: Get the virtualmachineclass, storageclass and tkrinformation for cluster creation from supervisor cluster

root@photon-machine [ ~ ]# k get virtualmachineclass
NAME                  CPU   MEMORY   AGE
best-effort-2xlarge   8     64Gi     2d19h
best-effort-4xlarge   16    128Gi    2d19h
best-effort-8xlarge   32    128Gi    2d19h
best-effort-large     4     16Gi     2d19h
best-effort-medium    2     8Gi      2d19h
best-effort-small     2     4Gi      2d19h
best-effort-xlarge    4     32Gi     2d19h
best-effort-xsmall    2     2Gi      2d19h
guaranteed-2xlarge    8     64Gi     2d19h
guaranteed-4xlarge    16    128Gi    2d19h
guaranteed-8xlarge    32    128Gi    2d19h
guaranteed-large      4     16Gi     2d19h
guaranteed-medium     2     8Gi      2d19h
guaranteed-small      2     4Gi      2d19h
guaranteed-xlarge     4     32Gi     2d19h
guaranteed-xsmall     2     2Gi      2d19h
root@photon-machine [ ~ ]# k get tkr
NAME                                VERSION                          READY   COMPATIBLE   CREATED   UPDATES AVAILABLE
v1.19.11---vmware.1-tkg.1.9d9b236   1.19.11+vmware.1-tkg.1.9d9b236   True    True         2d19h     [1.20.7+vmware.1-tkg.1.7fb9067]
v1.19.7---vmware.1-tkg.1.fc82c41    1.19.7+vmware.1-tkg.1.fc82c41    True    True         2d19h     [1.20.7+vmware.1-tkg.1.7fb9067 1.19.11+vmware.1-tkg.1.9d9b236]
v1.20.2---vmware.1-tkg.1.1d4f79a    1.20.2+vmware.1-tkg.1.1d4f79a    True    True         2d19h     [1.20.7+vmware.1-tkg.1.7fb9067]
v1.20.7---vmware.1-tkg.1.7fb9067    1.20.7+vmware.1-tkg.1.7fb9067    True    True         2d19h     
root@photon-machine [ ~ ]# k get storageclass
NAME                        PROVISIONER              RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
tanzu-gold-storage-policy   csi.vsphere.vmware.com   Delete          Immediate           true                   2d18h
root@photon-machine [ ~ ]# k get storageclass -A
NAME                        PROVISIONER              RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
tanzu-gold-storage-policy   csi.vsphere.vmware.com   Delete          Immediate           true                   2d18h
root@photon-machine [ ~ ]# k get storageclass -A
NAME                          PROVISIONER              RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
tanzu-gold-storage-policy     csi.vsphere.vmware.com   Delete          Immediate           true                   2d18h
vsan-default-storage-policy   csi.vsphere.vmware.com   Delete          Immediate           true                   10s

Step 2: create a cluster

root@photon-machine [ ~ ]#  tmc cluster create -it tkgs
 using template "tkgs"
? Name (youthful-minsky3) 
? Name youthful-minsky3
? ManagementClusterName dzhang-nimbus-vmc
? ManagementClusterName dzhang-nimbus-vmc
? ProvisionerName dzhang
? ProvisionerName dzhang
? Labels [? for help] 
? Labels 
? ClusterGroup (default) vmc-cluster
? ClusterGroup vmc-cluster
? PodsCidrBlocks [? for help] (192.0.2.0/16) 
? PodsCidrBlocks 192.0.2.0/16
? ServiceCidrBlocks [? for help] (198.51.100.0/12) 
? ServiceCidrBlocks 198.51.100.0/12
? AllowedStorageClasses [? for help] tanzu-gold-storage-policy
? AllowedStorageClasses tanzu-gold-storage-policy
? DefaultStorageClass tanzu-gold-storage-policy
? DefaultStorageClass tanzu-gold-storage-policy
? Version v1.19.7---vmware.1-tkg.1.fc82c41 
? Version v1.19.7---vmware.1-tkg.1.fc82c41 
? InstanceType (best-effort-2xlarge) best-effort-large
? InstanceType best-effort-large
? StorageClass tanzu-gold-storage-policy
? StorageClass tanzu-gold-storage-policy
? HighAvailability  [Use arrows to move, type to filter]
  true
> false
? HighAvailability false
? NodePoolName (default-node-pool) 
? NodePoolName default-node-pool
? NodePoolDescription (default description for the nodepool) 
? NodePoolDescription default description for the nodepool
? WorkerNodeCount (1) 
? WorkerNodeCount 1
? WorkerInstanceType (best-effort-2xlarge) best-effort-large
? WorkerInstanceType best-effort-large
fullName:
  managementClusterName: dzhang-nimbus-vmc
  name: youthful-minsky3
  provisionerName: dzhang
meta:
  labels: null
spec:
  clusterGroupName: vmc-cluster
  tkgServiceVsphere:
    distribution:
      version: v1.19.7
    settings:
      network:
        pods:
          cidrBlocks:
          - 192.0.2.0/16
        services:
          cidrBlocks:
          - 198.51.100.0/12
      storage:
        classes:
        - tanzu-gold-storage-policy
        defaultClass: tanzu-gold-storage-policy
    topology:
      controlPlane:
        class: best-effort-large
        highAvailability: false
        storageClass: tanzu-gold-storage-policy
      nodePools:
      - info:
          description: default description for the nodepool
          name: default-node-pool
        spec:
          tkgServiceVsphere:
            class: best-effort-large
            storageClass: tanzu-gold-storage-policy
          workerNodeCount: "1"
type:
  kind: Cluster
  package: vmware.tanzu.manage.v1alpha1.cluster
  version: v1alpha1

<aside> 💡 Don't support customised CNI yet

</aside>

root@photon-machine [ ~ ]# tmc cluster create -it tkgs
i using template "tkgs"
? Name (pedantic-darwin8) 
? Name pedantic-darwin8
? ManagementClusterName dzhang-m16-mgmt
? ManagementClusterName dzhang-m16-mgmt
? ProvisionerName prod01
? ProvisionerName prod01
? Labels [? for help] production
? Labels production
? ClusterGroup (default) vmc-cluster
? ClusterGroup vmc-cluster
? PodsCidrBlocks [? for help] (192.0.2.0/16) 10.99.0.0/16
? PodsCidrBlocks 10.99.0.0/16
? ServiceCidrBlocks [? for help] (198.51.100.0/12) 172.29.0.0/22
? ServiceCidrBlocks 172.29.0.0/22
? AllowedStorageClasses [? for help] tanzu-gold-storage-policy
? AllowedStorageClasses tanzu-gold-storage-policy
? DefaultStorageClass tanzu-gold-storage-policy
? DefaultStorageClass tanzu-gold-storage-policy
? Version v1.19.7---vmware.1-tkg.1.fc82c41
? Version v1.19.7---vmware.1-tkg.1.fc82c41
? InstanceType (best-effort-2xlarge) best-effort-large
? InstanceType best-effort-large
? StorageClass tanzu-gold-storage-policy
? StorageClass tanzu-gold-storage-policy
? HighAvailability  [Use arrows to move, type to filter]
  true
> false
? HighAvailability false
? NodePoolName (default-node-pool) test1000
? NodePoolName test1000
? NodePoolDescription (default description for the nodepool) 
? NodePoolDescription default description for the nodepool
? WorkerNodeCount (1) 
? WorkerNodeCount 1
? WorkerInstanceType (best-effort-2xlarge) best-effort-large
? WorkerInstanceType best-effort-large
    settings:
fullName:
  managementClusterName: dzhang-m16-mgmt
  name: pedantic-darwin8
  provisionerName: prod01
meta:
  labels: null
spec:
  clusterGroupName: vmc-cluster
  tkgServiceVsphere:
    distribution:
      version: v1.19.7---vmware.1-tkg.1.fc82c41
    settings:
      network:
        cni:
          name: calico
        pods:
          cidrBlocks:
          - 10.99.0.0/16
        services:
          cidrBlocks:
          - 172.29.0.0/22
      storage:
        classes:
        - tanzu-gold-storage-policy
        defaultClass: tanzu-gold-storage-policy
    topology:
      controlPlane:
        class: best-effort-large
        highAvailability: false
        storageClass: tanzu-gold-storage-policy
      nodePools:
      - info:
          description: default description for the nodepool
          name: test1000
        spec:
          tkgServiceVsphere:
            class: best-effort-large
            storageClass: tanzu-gold-storage-policy
          workerNodeCount: "1"
type:
  kind: Cluster
  package: vmware.tanzu.manage.v1alpha1.cluster
  version: v1alpha1
~
~
~
~
~
~
~
~
~
"/tmp/template.299926187.yaml" 43L, 1072C written                                                                                                                                                  
x unknown field "cni" in vmware.tanzu.manage.v1alpha1.cluster.infrastructure.tkgservicevsphere.NetworkSettings