Uncategorized

Tanzu from beginning – part 2

After finishing workload management we can create our first namespace.

I’ve create devops namespace on my Cluster

After creation we have to add Permission and Storage which we setup for this

at the bottom of page we have link for kubectl cli tool which is located on our Supervisor Cluster

unfortunately we have only here kubectl but also we need to download tkg tool but this can by done from my.vmware site

https://my.vmware.com/en/web/vmware/downloads/info/slug/infrastructure_operations_management/vmware_tanzu_kubernetes_grid/1_x

When whe have kubectl and tkg we can start preparing our first Tanzu Cluster

From command line :

  1. kubectl vsphere login –server=<SERVER_IP> –vsphere-username <USERNAME_ADDED_TO_NAMESPACE> –insecure-skip-tls-verify
  2. kubectl config use-context <NAMESPACE_NAME>
  3. be sure to put you management cluster as master tkg set management-cluster <CONTROL_PLANE_IP>
  4. Grab storage policy which will be needed for deploy cluster kubectl get storageclasses

On your user location you can be able to see .tkg directory with config.yaml files which you need to edit based on your valuse. This is my file, at the end I’ve add required information. All details how to fulflill this file you can found here

https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.0/vmware-tanzu-kubernetes-grid-10/GUID-tanzu-k8s-clusters-connect-vsphere7.htmlhttps://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.0/vmware-tanzu-kubernetes-grid-10/GUID-tanzu-k8s-clusters-connect-vsphere7.html

cert-manager-timeout: 30m0s
overridesFolder: C:\Users\administrator.VWORLD\.tkg\overrides
NODE_STARTUP_TIMEOUT: 20m
BASTION_HOST_ENABLED: "true"
providers:
  - name: cluster-api
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/cluster-api/v0.3.11/core-components.yaml
    type: CoreProvider
  - name: aws
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/infrastructure-aws/v0.6.3/infrastructure-components.yaml
    type: InfrastructureProvider
  - name: vsphere
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/infrastructure-vsphere/v0.7.1/infrastructure-components.yaml
    type: InfrastructureProvider
  - name: azure
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/infrastructure-azure/v0.4.8/infrastructure-components.yaml
    type: InfrastructureProvider
  - name: tkg-service-vsphere
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/infrastructure-tkg-service-vsphere/v1.0.0/unused.yaml
    type: InfrastructureProvider
  - name: kubeadm
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/bootstrap-kubeadm/v0.3.11/bootstrap-components.yaml
    type: BootstrapProvider
  - name: kubeadm
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/control-plane-kubeadm/v0.3.11/control-plane-components.yaml
    type: ControlPlaneProvider
  - name: docker
    url: file:///C:/Users/administrator.VWORLD/.tkg/providers/infrastructure-docker/v0.3.10/infrastructure-components.yaml
    type: InfrastructureProvider
images:
    all:
        repository: registry.tkg.vmware.run/cluster-api
    cert-manager:
        repository: registry.tkg.vmware.run/cert-manager
        tag: v0.16.1_vmware.1
release:
    version: v1.2.1
tkg:
    regions:
      - name: 172.16.1.208
        context: 172.16.1.208
        file: C:\Users\administrator.VWORLD\.kube-tkg\config
        status: ""
        isCurrentContext: false
    current-region-context: 172.16.1.208
CONTROL_PLANE_STORAGE_CLASS: tanzu
WORKER_STORAGE_CLASS: tanzu
SERVICE_DOMAIN: vworld.domain.local
CONTROL_PLANE_VM_CLASS: best-effort-xsmall
WORKER_VM_CLASS: best-effort-xsmall

when this file is created you can write your cluser yaml or create it automatically with command.

tkg config cluster my-cluster –plan=dev –controlplane-machine-count 1 –worker-machine-count 1 –namespace=devops > my-cluster.yaml

My file look like this

apiVersion: run.tanzu.vmware.com/v1alpha1
kind: TanzuKubernetesCluster
metadata:
  annotations:
    tkg/plan: dev
  labels:
    tkg.tanzu.vmware.com/cluster-name: my-cluster
  name: my-cluster
  namespace: devops
spec:
  distribution:
    version: v1.18.10+vmware.1
  settings:
    network:
      cni:
        name: antrea
      pods:
        cidrBlocks:
        - 100.96.0.0/11
      serviceDomain: vworld.domain.local
      services:
        cidrBlocks:
        - 100.64.0.0/13
    storage:
      classes: []
      defaultClass: tanzu
  topology:
    controlPlane:
      class: best-effort-xsmall
      count: 1
      storageClass: tanzu
    workers:
      class: best-effort-xsmall
      count: 1
      storageClass: tanzu

version which can be used you can find in Conten Library after adding subscribed library based on this url https://wp-content.vmware.com/v2/latest/lib.json

If you setup different conter library like I then you need to repoint you Supervisor Cluster to this new one

When everything is setup properly then you can run

kubectl apply -f my-cluster.yaml

this will bring to life new Kubernetes cluster based on your yaml file.

Now you can monitor progress on vCenter UI or this command kubectl get tanzukubernetesclusters

Share with:


Leave a Reply

Your email address will not be published. Required fields are marked *