Tag: VMC

  • Tanzu Service on VMware Cloud on AWS – Installing Tanzu Application Platform

    VMware Tanzu Application Platform is a modular, application detecting platform that provides a rich set of developer tools and a paved path to production to build and deploy software quickly and securely on any compliant public cloud or on-premises Kubernetes cluster.

    Tanzu Application Platform delivers a superior developer experience for enterprises building and deploying cloud-native applications on Kubernetes. It enables application teams to get to production faster by automating source-to-production pipelines. It clearly defines the roles of developers and operators so they can work collaboratively and integrate their efforts.

    Operations teams can create application scaffolding templates with built-in security and compliance guardrails, making those considerations mostly invisible to developers. Starting with the templates, developers turn source code into a container and get a URL to test their app in minutes.

    Pre-requisite

    1. You should have created an account on Tanzu Network to download Tanzu Application Platform packages.
    2. Servers should have Network access to https://registry.tanzu.vmware.com
    3. A container image registry and access from K8s cluster, in my case i have installed “Harbor” with let’s encrypt certificate.
    4. Registry credentials with read and write access made available to Tanzu Application Platform to store images.
    5. Git repository for the Tanzu Application Platform GUI’s software catalogs, along with a token allowing read access.

    Kubernetes cluster requirements

    Installation requires Kubernetes cluster v1.20, v1.21, or v1.22 on Tanzu Kubernetes Grid Service on VMware Cloud on VMC as well as pod security policies must be configured so that Tanzu Application Platform controller pods can run as root. To set the pod security policies, run:

    #kubectl create clusterrolebinding default-tkg-admin-privileged-binding --clusterrole=psp:vmware-system-privileged --group=system:authenticated

    Install Cluster Essentials for VMware Tanzu

    The Cluster Essentials for VMware Tanzu package simplifies the process of installing the open-source Carvel tools on your cluster. It includes a script that uses the Carvel CLI tools to download and install the server-side components kapp-controller and secretgen-crontroller on the targeted cluster. Currently, only MacOS and Linux are supported for Cluster Essentials for VMware Tanzu.

    • Sign in to Tanzu Network.
    • Navigate to Cluster Essentials for VMware Tanzu on VMware Tanzu Network.
    • on Linux, download tanzu-cluster-essentials-linux-amd64-1.0.0.tgz.
    • Unpack the TAR file into the tanzu-cluster-essentials directory by running:
    #mkdir $HOME/tanzu-cluster-essentials
    #tar -xvf tanzu-cluster-essentials-linux-amd64-1.0.0.tgz -C $HOME/tanzu-cluster-essentials
    
    • Configure and run install.sh using below commands:
    #export INSTALL_BUNDLE=registry.tanzu.vmware.com/tanzu-cluster-essentials/cluster-essentials-bundle@sha256:82dfaf70656b54dcba0d4def85ccae1578ff27054e7533d08320244af7fb0343
    #export INSTALL_REGISTRY_HOSTNAME=registry.tanzu.vmware.com
    #export INSTALL_REGISTRY_USERNAME=TANZU-NET-USER Name
    #export INSTALL_REGISTRY_PASSWORD=TANZU-NET-USER PASSWORD
    #cd $HOME/tanzu-cluster-essentials
    #./install.sh

    now Install kapp & imgpkg CLI onto your $PATH using below commands:

    sudo cp $HOME/tanzu-cluster-essentials/kapp /usr/local/bin/kapp
    sudo cp $HOME/tanzu-cluster-essentials/imgpkg /usr/local/bin/imgpkg

    For Linux Client VM: Install the Tanzu CLI and Plugins

    To install the Tanzu Tanzu command line interface (CLI) on a Linux operating system, Create a directory named Tanzu and download tanzu-framework-bundle-linux from Tanzu Net and unpack the TAR file into the Tanzu directory and install using below commands:

    #mkdir $HOME/tanzu 
    #tar -xvf tanzu-framework-linux-amd64.tar -C $HOME/tanzu
    #export TANZU_CLI_NO_INIT=true
    #cd $HOME/tanzu 
    #sudo install cli/core/v0.11.1/tanzu-core-linux_amd64 /usr/local/bin/tanzu
    #tanzu version
    #cd $HOME/tanzu
    #tanzu plugin install --local cli all
    #tanzu plugin list
    

    Ensure that you have the acceleratorappspackagesecret, and services plug-ins installed. You need these plug-ins to install and interact with the Tanzu Application Platform.

    Installing the Tanzu Application Platform Package and Profiles

    VMware recommends install of Tanzu Application Platform packages by relocating the images to your registry from VMware Tanzu Network registry, this will ease the deployment process, so lets do it by logging in to Tanzu Net Registry, setting some env variables and relocate images.

    #docker login registry.tanzu.vmware.com
    #export INSTALL_REGISTRY_USERNAME=MY-REGISTRY-USER
    #export INSTALL_REGISTRY_PASSWORD=MY-REGISTRY-PASSWORD
    #export INSTALL_REGISTRY_HOSTNAME=MY-REGISTRY
    #export TAP_VERSION=VERSION-NUMBER
    #imgpkg copy -b registry.tanzu.vmware.com/tanzu-application-platform/tap-packages:1.0.2 --to-repo ${INSTALL_REGISTRY_HOSTNAME}/TARGET-REPOSITORY/tap-packages

    This completes the download and upload on images to local registry.

    Create a registry secret by running below command:

    #tanzu secret registry add tap-registry \
      --username ${INSTALL_REGISTRY_USERNAME} --password ${INSTALL_REGISTRY_PASSWORD} \
      --server ${INSTALL_REGISTRY_HOSTNAME} \
      --export-to-all-namespaces --yes --namespace tap-install

    Add the Tanzu Application Platform package repository to the cluster by running:

    #tanzu package repository add tanzu-tap-repository \
      --url ${INSTALL_REGISTRY_HOSTNAME}/TARGET-REPOSITORY/tap-packages:$TAP_VERSION \
      --namespace tap-install

    Get the status of the Tanzu Application Platform package repository, and ensure the status updates to Reconcile succeeded by running:

    #tanzu package repository get tanzu-tap-repository --namespace tap-install

    Tanzu Application Platform profile

    The tap.tanzu.vmware.com package installs predefined sets of packages based on your profile settings. This is done by using the package manager you installed using Tanzu Cluster Essentials.Here is my full profile sample file:

    buildservice:
      descriptor_name: full
      enable_automatic_dependency_updates: true
      kp_default_repository: harbor.tkgsvmc.net/tbs/build-service
      kp_default_repository_password: <password>
      kp_default_repository_username: admin
      tanzunet_password: <password>
      tanzunet_username: tripathiavni@vmware.com
    ceip_policy_disclosed: true
    cnrs:
      domain_name: tap01.tkgsvmc.net
    grype:
      namespace: default
      targetImagePullSecret: tap-registry
    learningcenter:
      ingressDomain: learningcenter.tkgsvmc.net
    metadata_store:
      app_service_type: LoadBalancer
    ootb_supply_chain_basic:
      gitops:
        ssh_secret: ""
      registry:
        repository: tap
        server: harbor.tkgsvmc.net/tap
    profile: full
    supply_chain: basic
    tap_gui:
      app_config:
        app:
          baseUrl: http://tap-gui.tap01.tkgsvmc.net
        backend:
          baseUrl: http://tap-gui.tap01.tkgsvmc.net
          cors:
            origin: http://tap-gui.tap01.tkgsvmc.net
        catalog:
          locations:
            - target: https://github.com/avnish80/tap/blob/main/catalog-info.yaml
              type: url
      ingressDomain: tap01.tkgsvmc.net
      ingressEnabled: "true"
      service_type: LoadBalancer

    save this file with modified values as per your environment, for more details about details of settings, check Here.

    Install Tanzu Application Platform

    finally lets install TAP, to install the Tanzu Application Platform package run below commands:

    #tanzu package install tap -p tap.tanzu.vmware.com -v $TAP_VERSION --values-file tap-values.yml -n tap-install

    to verify the packages installed, you can go to TMC and check there

    or you an run below command to verify too

    #tanzu package installed get tap -n tap-install

    This completes the installation of Tanzu Application platform, now developer can: Develop and promote an application, Create an application accelerator, Add testing and security scanning to an application, Administer, set up, and manage supply chains.

  • Tanzu Service on VMware Cloud on AWS – Kubernetes Cluster Operations

    Tanzu Kubernetes Grid is a managed service offered by VMware Cloud on AWS. Activate Tanzu Kubernetes Grid in one or more SDDC clusters to configure Tanzu support in the SDDC vCenter Server.In my previous post (Getting Started with Tanzu Service on VMware Cloud on AWS),in this i walked you through how to enable Tanzu Service on VMware Cloud on AWS.

    In this post i will deploy Tanzu Kubernetes Cluster by GUI (from Tanzu Mission Control) and as well as CLI but this CLI is updated API V2 version, so lets get started.

    Deploy Tanzu Kubernetes Cluster using Tanzu Mission Control

    Go to Tanzu Mission Control and validate that VMC supervisor cluster is registered and healthy by going to Tanzu Mission Control, Click on Administration, to go “management cluster” and check the status

    Now on Tanzu Mission Control, click on “Clusters” and then click on “CREATE CLUSTER”

    Select your VMC Tanzu Management Cluster and click on “CONTINUE TO CREATE CLUSTER”

    on the next screen choose “Provisioner” (namespace name”). you add a provisioner by creating a vSphere namespace in the Supervisor Cluster, which you can do in VMC vCenter.

    Next is select Kubernetes Version, latest supported version is preselected for you, Pod CIDR, and Service CIDR. You can also optionally select the default storage class for the cluster and allowed storage classes.The list of storage classes that you can choose from is taken from your vSphere namespace.

    Select the type of cluster you want to create. the primary difference between the two is that the highly available cluster is deployed with multiple control plane nodes.

    You can optionally select a different instance type for the cluster’s control plane node and its storage class as well as you can optionally additional storage volumes for your control plane.

    To configure additional volumes, click Add Volume and then specify the name, mount path, and capacity for the volume. To add another, click Add Volume again.

    Next is you can define the default node pool and create additional node pools for your cluster. specify the number of worker nodes to provision also select the instance type for workload clusters and select the storage class

    When you ready to provision the new cluster, click Create Cluster and wait for few minutes

    you can also view vCenter activities about creation of Tanzu Kubernetes cluster.

    Once the cluster is fully created and TMC agent reported back, you should see below status on TMC console, which shows that cluster has been successfully created.

    This complates Tanzu Kubernetes Cluster deployment using GUI.

    Deploy Tanzu Kubernetes Grid Service using v1alpha2 API yaml

    The Tanzu Kubernetes Grid Service v1alpha2 API provides a robust set of enhancements for provisioning Tanzu Kubernetes clusters. there is an YAML specification which i am using for provisioning a Tanzu Kubernetes Cluster Using the Tanzu Kubernetes Grid Service v1alpha2 API

    apiVersion: run.tanzu.vmware.com/v1alpha2
    kind: TanzuKubernetesCluster
    metadata:
      name: tkgsv2
      namespace: wwmca
    spec:
      topology:
        controlPlane:
          replicas: 1
          vmClass: guaranteed-medium
          storageClass: vmc-workload-storage-policy-cluster-1
          volumes:
            - name: etcd
              mountPath: /var/lib/etcd
              capacity:
                storage: 4Gi
          tkr:  
            reference:
              name: v1.21.2---vmware.1-tkg.1.ee25d55
        nodePools:
        - name: worker-nodepool-a1
          replicas: 2
          vmClass: best-effort-large
          storageClass: vmc-workload-storage-policy-cluster-1
          tkr:  
            reference:
              name: v1.21.2---vmware.1-tkg.1.ee25d55
      settings:
        storage:
          defaultClass: vmc-workload-storage-policy-cluster-1
        network:
          cni:
            name: antrea
          services:
            cidrBlocks: ["198.53.100.0/16"]
          pods:
            cidrBlocks: ["192.0.5.0/16"]
          serviceDomain: managedcluster.local
          trust:
            additionalTrustedCAs:
              - name: CompanyInternalCA-1
                data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlG

    Two key parameters which i am using for cluster provistioning

    • #tkr.reference.name is the TKR NAME #to be used by control plane nodes; supported format is “v1.21.2—vmware.1-tkg.1.ee25d55”
    • #trust configures additional certificates for the cluster #if omitted no additional certificate is configured

    You can run below command to check the status of cluster provustioning:

    #kubectl get tkc

    Scale a Tanzu Kubernetes cluster

    Publish the service Internally/Externally

    Before we can make our service available over the Internet, it should be accessible from within the VMware Cloud on AWS instance. Platform operators can publish applications through a Kubernetes Service of type LoadBalancer. This ability is made possible through the NSX-T Container Plugin (NCP) functionality built into Tanzu Kubernetes Grid. lets deploy a basic container and exposed it as type “LoadBalancer”

    #kubectl run nginx1 --image=nginx
    #kubectl expose pod nginx1 --type=LoadBalancer --port=80

    Now you can access the application internally by accessing internal

    Access application from Internet

    To make it publicly available, we must assign a public IP address, and configure a Destination NAT, let do it request an Public IP on VMC console and create a NAT rule on Internet Tab to access the application from internet.

    Now access the application from Internet and you should be able to successfully access it using provided public ip.

    Exposing a Kubernetes service to the Internet takes a couple of more steps to complete than exposing it to your internal networks, but the VMware Cloud Console makes those steps simple enough. After exposing the Kubernetes service using an NSX-T Load Balancer, you can request a new Public IP Address and then configure a NAT rule to send that traffic to the virtual IP address of the load balancer.