nextcloud-harvester-demo/02-launch-vm
2024-09-11 19:53:37 -07:00
..
README.md Add credentials section 2024-09-11 19:53:37 -07:00

Launch a VM

Now that we have a namespace and image, it's time to start a deployment. This section will go through setting up a VM deployment from scratch that we'll use to setup Nextcloud.


NOTE: If you have not done so already, at the top right switch the UI view to your namespace. If it says "All Namespaces", you'll see all the other resources in the project. Changing this now will show your own resources and help prevent you from accidentally touching someone else's during this demo.


Launch a VM

On left navigation bar on the left side, click on Virtual Machines.

VMs that you create will show up here. To create one, click the Create button on the top right.

At the top fill in the following details:

  • Leave it as Single Instance
  • Namespace: Change this to your namespace
  • Name: Name for your VM (eg, nextcloud-demo)
  • Description (optional): Describe what your VM is for, (eg, "Nextcloud Server")
  • Leave "Use VM Template" unchecked (more on that in Section 4)

Fill in these sections using navigation on the left-hand side:

Basics:

  • Set CPUs to 2
  • Memory: 8 GB (If you want to skip Mariadb and use sqlite, use 4 instead)
  • SSHKey: Leave blank for now

Volumes:

  • Name: unique volume name (eg, nextcloud-root)
  • Type: disk
  • Image: Select the image you uploaded in the previous section or the OpenSUSE 15.6 image from harvester-public
  • Size: 20
  • Bus: VirtIO
  • Optional: Add two more 10GB volumes for database and nextcloud user data storage

Networks:

  • Delete the default Management Network using the X on the top right. We won't need it for this demo.
  • Add Network
  • Name: nic-1 is fine, but something like "public-1" is intuitive
  • Model: virtio
  • Network: harvester-public/2176 (This will get us a DHCP public IP)
  • Type: bridge

Node Scheduling, VM Scheduling, Advanced Options: Note the availability of things here but don't change anything for the sake of this demo. Also note that you could automate almost of the entire next section of this tutorial with cloud-config data here now.

Instance Labels (optional): set vmName to the Name at the top

Now click the blue "Create" button on the bottom right.

CONGRATS! You've just deployed your first Harvester VM. Now, we wait a minute or two while kube-virt gets storage, assigns the VM to a node, and starts it. This typically takes ~1-10 minutes.

(If you see an error about a VMI hook failure, it should clear once storage has provisioned.)

Accessing the VM

Once the VM shows a status of Running (from Off, then Assigned), you can now access it through three different methods. The Console drop down has options for Web VNC and Serial (No specialjava agents or browser plugins needed here!). The VNC method is certainly prettier but you might get more kernel info from the serial console and the serial console can work with copy-and-paste.

The other option is to ssh using the IP address that was assigned shortly after startup via DHCP.

By this point, you may have noticed that we never set credentials. Oops, silly me. Let's fix that now:

  • Click on your VM's name
  • Click on the Access Credentials on the left-hand side. This shows the current config, but we need to Edit the VM to update it.
  • Click on the three dots on the top right and select "Edit Config"
  • Click on Access Credentials again and you'll see options to add a Basic Auth or SSHKey
  • Use Basic Auth for password access (required for VNC/console) and/or SSHKey (public) for ssh.
  • Add user and use 'opensuse' for the user name so you'll have sudo.
  • Save when you're done

Since this leverages cloud-data to do this, you'll need to reboot the VM for it to take effect: Select "Save & Restart" or click the three dots on the right side of the VM and select Restart from there.

Note that when it comes back up, your credentials should work once cloud-init is applied shortly after boot and that the IP address may have changed after restart.