Using Ubuntu Cloud Images as Virtual Machines

General outline

  • Find an appropriate Ubuntu Server cloud image
  • Create Data Store
  • Create App Image
  • Create Marketplace App
    • Apply custom cloud-init configuration
      • Assign username/password
      • Network configuration
      • Install your app?
  • Deploy VM to the edge node

Find an Ubuntu Cloud Image

Explore Long-Term Stable (LTS) release images http://cloud-images.ubuntu.com/releases/ 

For x86 (AMD64) EVE-OS edge nodes, select: 64-bit Cloud image

image10.png

Example Release Images

Focal Fossa (20.04) : 

http://cloud-images.ubuntu.com/releases/focal/release/ 

64-bit Cloud Image

ubuntu-20.04-server-cloudimg-amd64.img   2022-05-30 22:53  568M  Cloud image for 64-bit computers (USB image)

SHA256SUMS

SHA256 specific to this image link:

103ae8982d79891e7fb5321260dbd7e924ec2021d7357872d0c65e3231466d23 *ubuntu-20.04-server-cloudimg-amd64.img

Download the file to get exact image size in Bytes:

Downloads % ls -l
-rw-r--r--@ 1 kathy  staff  595197952 Jun  7 10:54
ubuntu-20.04-server-cloudimg-amd64.img

Jammy Jellyfish (22.04)

http://cloud-images.ubuntu.com/releases/22.04/release/

64-bit Cloud Image

ubuntu-22.04-server-cloudimg-amd64.img   2022-06-04 02:39  598M  Cloud image for 64-bit computers (USB image)

SHA256SUMS

SHA256 specific to this image link:

8120f574303fbc99d6ee3c8bacede5881d9968f730bb45fdab7cb457078afb1e *ubuntu-22.04-server-cloudimg-amd64.img

Download the file to get exact image size in Bytes:

Downloads % ls -l
-rw-r--r--@ 1 kathy  staff  626655232 Jun  7 10:45
ubuntu-22.04-server-cloudimg-amd64.img

The above image links and associated file size and SHA256 values will be required for the next two sections of creating a data store and an app image.

Create Data Store

Navigate to Library > Data Stores

Click + to add a new Data Store

Complete the required fields that identify the location of Ubuntu cloud image releases, then click “Add”.

Example input data:

Identity

Name: ubuntu-cloud-images

Title: Ubuntu Cloud Image Releases

Description: Ubuntu images are located at http://cloud-images.ubuntu.com/releases

Details

FQDN: http://cloud-images.ubuntu.com

Type: HTTP

Path: releases

Create an App Image

Navigate to Library > App Images

Click + to add a new App Image

Complete the required fields that identify the specific Ubuntu cloud image, then click “Add”.

Example input data:

Identity

Name: Ubuntu-Focal-20.04

Title: Ubuntu Cloud Image Release Focal 20.04

Description: Full image path is http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img

Image Format: QCOW2

Image Architecture: AMD 64

Data Store: ubuntu-cloud-images

Image Relative URL: focal/release/ubuntu-20.04-server-cloudimg-amd64.img

Image SHA256: 103ae8982d79891e7fb5321260dbd7e924ec2021d7357872d0c65e3231466d23

Image Size: 595197952 BYTES

Create Marketplace App

Navigate to Library > App Images

Click + to add a new App Image

Select the app type (in this tutorial example, select “Virtual Machine”).

Fill in the form to provide application information and policies (or upload a JSON manifest):

  • Identify the app image (created in the previous step)
  • Apply network policies
  • Configure #cloud-init (optional)
  • Document the app creator, applicable licensing, and support options

Example input data:

Identity

Name: ubuntu-20.04-focal

Title: Ubuntu 20.04 Cloud Image

Description: LTS Ubuntu Cloud image for AMD 64 (x86) architecture edge nodes

Category: Operating System

Version: 20.04

Deployment Type: Standalone

VNC Connection: Yes (checked)

VM Mode: HVM

License: (optional)

Resources

Resource: Typical

CPUs: 2

Memory: 1.00 GB

Storage: 100.00 GB

Drives

Drive Type: HDD

Target: Disk

Tag: (optional – used to point to block volume instance tied to a content volume instance)

App Image: Ubuntu-Focal-20.04

Max Size: 100 GB

Mount Path (optional – more useful for containers)

Encrypted: Yes (checked)

Purge: Yes (checked)

Environments

Name: eth0

Direct Attach: No (unchecked)

Outbound Rules

Outbound Host or IP: 0.0.0.0/0

Protocol: Any

Port: Any

Action: Allow

Rate: Not Available

Burst: Not Available

Inbound Rules

Protocol: TCP

Edge Node Port: 8022

Action: Map

Edge App Port: 22

Rate: Not Available

Burst: Not Available

Inbound IP Address: 0.0.0.0/0

Protocol: TCP

Edge Node Port: 15600

Action: Map

Edge App Port: 15600

Rate: Not Available

Burst: Not Available

Inbound IP Address: 0.0.0.0/0

Environments (continued)

OPTION A

Name: eth1

Direct Attach: Yes (checked)

Adapter Type: Ethernet

(In this case, the edge node MUST have its corresponding interface assigned as “App Direct”.)

When might you want to use this option? If the port will be used for more complicated networking than the usual sending/receiving ethernet packets. For example:

  • SR-IOV capable NIC
  • Edge Node interface configured as a Wi-Fi access point or Wi-Fi router
  • EVE-OS doesn’t have the device driver for the NIC
  • App requires a custom device driver (e.g., legacy industrial ethernet)

OPTION B

Name: eth1

Direct Attach: No (unchecked)

Outbound Rules

Outbound Host or IP: 0.0.0.0/0

Protocol: Any

Port: Any

Action: Allow

Rate: Not Available

Burst: Not Available

Inbound Rules

(none)

Configuration

Add Custom Config Template: Yes (checked)

Configuration Name: user-net-app-inits

Allow Edge App deployments to set the entire configuration. No (unchecked)

Allow Storage Resize: Yes (checked)

Variable Delimiter: ###

Configuration Template:

#cloud-config
# Add a user with ubuntu/ubuntu credential and sudo permission
users:
- name: ubuntu
 gecos: ZEDEDA ubuntu user
 shell: /bin/bash
 sudo: ALL=(ALL) NOPASSWD:ALL
 lock_passwd: False
 passwd: $6$7TwC/VLEFz$2vZHtieAvauw.KGLnIEkGAKuXgMtOxjROTk0rs/s25ZTiJcUPKN5gvlm68kq0PiU8GT7RnCBmXIpJi7TfoiC9/
runcmd:
 - sed -i -e '/^PasswordAuthentication/s/^.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config
 - service sshd restart
# set one port to dynamic and one to a static IP address
network:
 version: 2
 ethernets:
   enp0s3:
     dhcp4: true
   enp0s4:
     addresses: [192.168.2.111/24]
# gateway4: 192.168.2.1
# nameservers:
#    addresses: [4.2.2.2, 8.8.8.8]

Variable Groups

This section contains optional variable value definitions that can be input at the time of app deployment, such as enabling the static IP address to be assigned at the time of application deployment. For example, the cloud-init networking section might look like this:

# set one port to dynamic and one to a static IP address
network:
 version: 2
 ethernets:
   enp0s3:
     dhcp4: true
   enp0s4:
     addresses: [###STATIC_IP###/###SUBNET###]
# gateway4: [###GATEWAY_IP###]
# nameservers:
#      addresses: [###NS1###, ###NS2###]

Deploy App to EVE-OS Edge Node

Notes on cloud-init

Doc resources to help with cloud-init configs for networking:

https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html

https://www.linuxtechi.com/assign-static-ip-address-ubuntu-20-04-lts/

Open cloud-init file “/etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg” and make sure entry “network: {config: disabled}” is there. In case this entry is missing, then add it manually.

$ cat /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg
network: {config: disabled}
$ ip add show
#cloud-config
# Add a user with ubuntu/ubuntu credential and sudo permission
users:
- name: ubuntu
 gecos: ZEDEDA ubuntu user
 shell: /bin/bash
 sudo: ALL=(ALL) NOPASSWD:ALL
 lock_passwd: False
 passwd: $6$7TwC/VLEFz$2vZHtieAvauw.KGLnIEkGAKuXgMtOxjROTk0rs/s25ZTiJcUPKN5gvlm68kq0PiU8GT7RnCBmXIpJi7TfoiC9/
runcmd:
 - sed -i -e '/^PasswordAuthentication/s/^.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config
 - service sshd restart
# set one port to dynamic and one to a static IP address
network:
 version: 2
 ethernets:
   enp0s3:
     dhcp4: true
   enp0s4:
     addresses: [192.168.2.111/24]
# gateway4: 192.168.2.1
# nameservers:
#    addresses: [4.2.2.2, 8.8.8.8]
# routes:
# - to: 0.0.0.0/0
#   via: a.b.c.d
#   metric: 3
runcmd:
 - sudo netplan apply
Was this article helpful?
0 out of 3 found this helpful

Articles in this section