Skip to content

Deploy Jumphost

We will go through three phases in this section to deploy jumphost VM which you will use to deploy AI applications.

  1. Create Cloud-Init: needed to bootstrap JumpHost VM on Nutanix AHV using OpenTofu
  2. Create Jumphost VM: needed to remotely connect and run deployment workflows accessible to Nutanix Infrastructure.
  3. Deploy Nutanix AI Utils: needed to bootstrap, monitor and troubleshoot Nutanix Cloud-Native AI applications using Gitops across fleet of Nutanix Kubernetes Clusters.
stateDiagram-v2
    direction LR

    state DeployJumpHost {
        [*] --> CreateCloudInit
        CreateCloudInit --> CreateJumpHostVM
        CreateJumpHostVM --> DeployNaiUtils
        DeployNaiUtils --> [*]
    }

    PrepWorkstation --> DeployJumpHost 
    DeployJumpHost --> DeployNkp : Next Section (Option A)
    DeployJumpHost --> DeployNke : Next Section (Option B)

Prerequisites

Jump Host VM Requirements

Based on the Nutanix GPT-in-a-Box specifications, the following system resources are required for the Jump Host VM:

  • Target OS: Ubuntu 22.04 LTS

Minimum System Requirements:

CPU Cores Per CPU Memory Storage
2 vCPU 4 Cores 16 GiB 300 GiB

Create Jump Host VM

In the following section, we will create a Jump Host VM on Nutanix AHV using both Visual Studio Code (VSCode) and OpenTofu.

  1. Open VSCode, Go to File -> New Window , Click on Open Folder and create new workspace folder (i.e., tofu-workspace).

  2. In VSCode Explorer pane, Click on New Folder and name it: jumphost-vm

  3. In the jumphost-vm folder, click on New File with the following name

    cloud-init.yaml
    
  4. Paste the following contents inside the file:

    cloud-init.yaml
    #cloud-config
    hostname: nai-llm-jumphost
    package_update: true
    package_upgrade: true
    package_reboot_if_required: true
    packages:
      - open-iscsi
      - nfs-common
    runcmd:
      - systemctl stop ufw && systemctl disable ufw
    users:
      - default
      - name: ubuntu
        groups: sudo
        shell: /bin/bash
        sudo:
          - 'ALL=(ALL) NOPASSWD:ALL'
        ssh-authorized-keys: 
        - ssh-rsa XXXXXX.... # (1)    
    
    1. Copy and paste the contents of your ~/.ssh/id_rsa.pub file or any public key file that you wish to use.


      If you are using a Mac, the command pbcopycan be used to copy the contents of a file to clipboard.

      cat ~/.ssh/id_rsa.pub | tr -d '\n' | pbcopy
      

      Cmd+v will paste the contents of clipboard to the console.

    Warning

    If needed, make sure to update the target hostname and copy / paste the value of the RSA public key in the cloudinit.yaml file.

  5. In VSCode Explorer, within the jumphost-vm folder, click on New File and create a config file with the following name:

    jumphostvm_config.yaml
    

    Update Nutanix environment access details along with any Jump Host VM configurations. See example file for details

    jumphostvm_config.yaml
    endpoint: "PC FQDN"
    user: "PC user"                  
    password: "PC password"          
    cluster_name: "PE Cluster Name"  
    subnet_name: "PE subnet"  
    name: "nai-llm-jumphost"
    num_vcpus_per_socket: "4"
    num_sockets: "2"
    memory_size_mib: 16384
    disk_size_mib: 307200
    source_uri: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img"
    
    jumphostvm_config.yaml
    endpoint: "pc.example.com"    # < Change to PC endpoint >
    user: "user01"                # < Change to PC admin user> 
    password: "XXXXXXXX"          # < Change to PC admin pass>
    cluster_name: "mypecluster"   # < Change to PE element cluster name >
    subnet_name: "VLAN.20"        # < Change to PE element subnet name >
    name: "nai-llm-jumphost" # (1)!
    num_vcpus_per_socket: "4"
    num_sockets: "2"
    memory_size_mib: 16384
    disk_size_mib: 307200
    source_uri: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img"
    
    1. make sure to update hostname with same name defined within cloudinit.yaml.

    Tip

    If you are using a Mac and pbcopy utility as suggested in the previous command's tip window, Cmd+v will paste the contents of clipboard to the console.

  6. In VSCode Explorer pane, navigate to the jumphost-vm folder, click on New File and create a opentofu manifest file with the following name:

    jumphostvm.tf
    

    with the following content:

    jumphostvm.tf
    terraform {
      required_providers {
        nutanix = {
          source  = "nutanix/nutanix"
          version = "1.9.5"
        }
      }
    }
    
    locals {
      config = yamldecode(file("${path.module}/jumphostvm_config.yaml"))
    }
    
    data "nutanix_cluster" "cluster" {
      name = local.config.cluster_name
    }
    data "nutanix_subnet" "subnet" {
      subnet_name = local.config.subnet_name
    }
    
    provider "nutanix" {
      username     = local.config.user
      password     = local.config.password
      endpoint     = local.config.endpoint
      insecure     = true
      wait_timeout = 60
    }
    
    resource "nutanix_image" "machine-image" {
      name        = element(split("/", local.config.source_uri), length(split("/", local.config.source_uri)) - 1)
      description = "opentofu managed image"
      source_uri  = local.config.source_uri
    }
    
    resource "nutanix_virtual_machine" "nai-llm-jumphost" {
      name                 = local.config.name
      cluster_uuid         = data.nutanix_cluster.cluster.id
      num_vcpus_per_socket = local.config.num_vcpus_per_socket
      num_sockets          = local.config.num_sockets
      memory_size_mib      = local.config.memory_size_mib
      guest_customization_cloud_init_user_data = base64encode(file("${path.module}/cloud-init.yaml"))
      disk_list {
        data_source_reference = {
          kind = "image"
          uuid = nutanix_image.machine-image.id
        }
        disk_size_mib = local.config.disk_size_mib
      }
      nic_list {
        subnet_uuid = data.nutanix_subnet.subnet.id
      }
    
      depends_on = [nutanix_image.machine-image]
    }
    
    output "nai-llm-jumphost-ip-address" {
      value = nutanix_virtual_machine.nai-llm-jumphost.nic_list_status[0].ip_endpoint_list[0].ip
      description = "IP address of the Jump Host vm"
    }
    
  7. Open a terminal within VSCode, Terminal > New Terminal

  8. Initialize and Validate your tofu code

    tofu -chdir=tofu-workspace/jumphost-vm init -upgrade
    
    tofu -chdir=tofu-workspace/jumphost-vm validate
    
  9. Apply your tofu code to create Jump Host VM

    tofu -chdir=tofu-workspace/jumphost-vm apply 
    

    Type yes to confirm

  10. Obtain the IP address of the Jump Host VM from the Tofu output

    Outputs:
    
    nai-llm-jumphost-ip-address = "10.x.x.x"
    
  11. Run the Terraform state list command to verify what resources have been created

    tofu state list
    
    # Sample output for the above command
    
    data.nutanix_cluster.cluster              # < This is your existing Prism Element cluster
    data.nutanix_subnet.subnet                # < This is your existing primary subnet
    nutanix_image.machine-image               # < This is the image file for `Jump Host` VM
    nutanix_virtual_machine.nai-llm-jumphost  # < This is the `Jump Host` VM
    
  12. Validate that the Jump Host VM is accessible using VSCode > Terminal

    ssh -i ~/.ssh/id_rsa ubuntu@<ip-address-from-tofu-output>
    
    ssh -i ~/.ssh/id_rsa ubuntu@10.x.x.171
    

Initiate Remote-SSH Connection to Jumpbox using VSCode

  1. In VSCode, click on Settings menu icon (gear icon) ⚙ > Settings > Extensions
  2. In the search window search for Remote SSH
  3. Install the Remote-SSH Extension from VSCode Marketplace
  4. click on the Install button for the extenstion.

  5. From your workstation, open Visual Studio Code.

  6. Click View > Command Palette.

  7. Click on + Add New SSH Host and t

  8. Type ssh ubuntu@jumphost_VM-IP-ADDRESS>and hit Enter.

  9. Select the location to update the config file.

    /Users/<your-username>/.ssh/config
    
    C:\\Users\\<your-username>\\.ssh\\config
    
  10. Open the ssh config file on your workstation to verify the contents. It should be similar to the following content

    Host jumphost
        HostName 10.x.x.x # (1)!
        IdentityFile ~/.ssh/id_rsa # (2)!
        User ubuntu
    
    1. This is Jumphost VM IP address

    2. This would be the path to RSA private key generated in the previous JumpHost section

    Now that we have saved the ssh credentials, we are able to connect to the jumphost VM

Connect to you Jumpbox using VSCode

  1. On VSCode, Click View > Command Palette and Connect to Host

  2. Select the IP address of your Jump Host VM

  3. A New Window will open in VSCode

  4. Click the Explorer button from the left-hand toolbar and select Open Folder.

  5. Provide the $HOME/ as the folder you want to open and click on OK.

    Note

    Ensure that bin is NOT highlighted otherwise the editor will attempt to autofill /bin/. You can avoid this by clicking in the path field before clicking OK.

    Warning

    The connection may take up to 1 minute to display the root folder structure of the jumphost VM.

  6. Accept any warning message about trusting the author of the folder

Install Utilities on Jumphost VM

We have compiled a list of utilities that needs to be installed on the jumphost VM to use for the rest of the lab. We have affectionately called it as nai-llm utilities. Use the following method to install these utilities:

  1. Using VSCode, open Terminal on the Jump Host VM

  2. Install devbox using the following command and accept all defaults

    curl -fsSL https://get.jetpack.io/devbox | bash
    
  3. From the $HOME directory, clone the sol-cnai-infra git repo and change working directory

    git clone https://github.com/nutanix-japan/sol-cnai-infra.git
    cd $HOME/sol-cnai-infra/
    
  4. Start the devbox shell. If nix isn't available, you will be prompted to install:

    devbox init
    devbox shell
    
  5. Run Post VM Create - Workstation Bootstrapping tasks

    sudo snap install task --classic
    task ws:install-packages ws:load-dotfiles --yes -d $HOME/sol-cnai-infra/
    source ~/.bashrc
    
  6. Change working directory and see Task help

    cd $HOME/sol-cnai-infra/ && task
    
    # command output
    task: bootstrap:silent
    
    Silently initializes cluster configs, git local/remote & fluxcd
    
    See README.md for additional details on Getting Started
    
    To see list of tasks, run `task --list` or `task --list-all`
    
    dependencies:
    - bootstrap:default
    
    commands:
    - Task: bootstrap:generate_local_configs
    - Task: bootstrap:verify-configs
    - Task: bootstrap:generate_cluster_configs
    - Task: nke:download-creds 
    - Task: flux:init
    

Setup Docker on Jumphost

  1. From VSC, logon to your jumpbox VM
  2. Open VSC Terminal
  3. Run the following commands to install docker binaries

    cd $HOME/sol-cnai-infra/; devbox init; devbox shell
    task workstation:install-docker
    

    Tip

    Restart the jumpbox host if ubuntu user has permission issues using docker commands.

Now the jumphost VM is ready with all the tools to deploy other sections on this site.