Tutorial and Examples#

The virtual edge node offers flexible deployment options utilizing both Interactive (IO) and Non-Interactive (NIO) flows. For streamlined operations, the security feature is configured as “securityFeature”:”SECURITY_FEATURE_NONE”, allowing seamless integration with various environments. Supported OS resources include Ubuntu* OS and Edge Microvisor Toolkit. Following is the common configurations used in VMs deploy using IO and NIO flow for different OS profiles.

Configuration#

Define the VM configuration such as CPU, memory, storage, and network using a configuration file, modify config file with the following template:

Step-1: Repository Setup#

Start by cloning the repository that contains all the necessary scripts and configurations for deployment. This step is crucial for accessing the tools required for virtual edge node provisioning:

git clone https://github.com/open-edge-platform/virtual-edge-node.git
cd vm-provisioning

Step-2: Default VM Configuration#

# Cluster FQDN
CLUSTER="orch-pid.example.com"

# VM Resources
RAM_SIZE=8192
NO_OF_CPUS=4
SDA_DISK_SIZE="110G"
LIBVIRT_DRIVER="kvm"

# Linux Provisioning
USERNAME="user"
PASSWORD="user"

Customize the values to match your deployment needs.

Step-3: Download Edge Orchestrator Certificate#

To download the Full_server.crt file and save it in the certs directory, follow these steps using wget.

source ./config
wget https://"tinkerbell-nginx.${CLUSTER}"/tink-stack/keys/Full_server.crt --no-check-certificate -O certs/"Full_server.crt"

Step-4: Create Provide with OS Resource#

There are two options to set the Provider with OS Resource:

Option 1: Manual Provider Creation Using Curl Command#

1. Source the configuration file and export configs#

source ./config
export PROJECT_API_USER="your_project_api_username"
export PROJECT_API_PASSWORD="your_project_api_password"
export PROJECT_NAME="your-project-name"
  1. Obtain the JSON Web Token (JWT)

export JWT_TOKEN=$(curl --location --insecure --request POST "https://keycloak.${CLUSTER}/realms/master/protocol/openid-connect/token" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=system-client' \
--data-urlencode "username="${PROJECT_API_USER}" \
--data-urlencode "password="${PROJECT_API_PASSWORD}" \
--data-urlencode 'scope=openid profile email groups' | jq -r '.access_token')

3. Sample configuration to delete a provider#

curl -X DELETE -H 'Accept: application/json' -H "Authorization: Bearer ${JWT_TOKEN}" --header "Content-Type: application/json" \
https://api.${CLUSTER}/v1/projects/${PROJECT_NAME}/providers/{provider-a2a751f9}

4. Sample configuration to create a provider with an OS instance#

curl -X POST "https://api.${CLUSTER}/v1/projects/${PROJECT_NAME}/providers" -H "accept: application/json" \
-H "Content-Type: application/json" -d '{"providerKind":"PROVIDER_KIND_BAREMETAL","name":"infra_onboarding", \
"apiEndpoint":"xyz123", "apiCredentials": ["abc123"], "config": "{\"defaultOs\":\"os-51c4eba0\",\"autoProvision\":false}" }' \
-H "Authorization: Bearer ${JWT_TOKEN}"

Important: For detailed instructions on configuring autoProvision settings, refer to Example 4: Auto Provisioning

Option 2: Automated Provider Creation Using Script#

This update_provider_defaultos.sh script is designed to automate the process of updating the default OS profile in a provider and enable auto provisioning for virtual edge nodes. It interacts with a cloud API to manage OS profiles and providers, ensuring that the correct OS is set as the default for provisioning.

Auto Provisioning: The new provider is configured with autoProvision set to true, enabling automatic provisioning of virtual edge nodes.

Before running the script, export the configuration variables from config and nio_configs.sh

source ./config
source ./scripts/nio_configs.sh

To execute the script, use the following command:

Edge Microvisor Toolkit: Update the provider with Edge Microvisor Toolkit.

./scripts/update_provider_defaultos.sh microvisor

Ubuntu OS: Update the provider with Ubuntu os.

./scripts/update_provider_defaultos.sh ubuntu

Step 5: Install Necessary Packages#

Navigate to the vm-provisioning directory and install the required packages to prepare the environment for VM creation. Execute the following commands:

chmod +x install_packages.sh
./install_packages.sh

Follow the examples for IO and NIO flow using the Ubuntu and Edge Microvisor Toolkit OS profiles.