Skip to main content

Installing Space Agent for VMs

In instances where services are not managed within a Kubernetes cluster, the Space Agent binary can be used outside the cluster to consume services within a Virtual Private Cloud (VPC).

note

Space Agent for VMs currently only supports Consume and does not support Serve.

You will need to download the version for your CPU architecture type:

Arch TypeURL
amd64https://releases.codezero.io/latest/spaceagent-linux-amd64.tar.gz
arm64https://releases.codezero.io/latest/spaceagent-linux-arm64.tar.gz

Environment Variables

The following environment variables can be set to configure the Space Agent:

Environment VariableDescription
CZ_SPACE_CONFIGFile path to the configuration file
CZ_EXTERNAL_HOSTExternal hostname of the Space Agent
CZ_HUB_SPACE_NAMEName of Teamspace
CZ_HUB_ORG_IDYour Organization ID
CZ_HUB_ORG_APIKEYYour Organization API Key
CZ_SPACE_CA_CERTFile path to store the Teamspace certificate, if not specified defaults to /etc/ssl/certs/space/ca.pem
CZ_CLUSTER_CERTFile path to store the Space Agent certificate, if not specified defaults to /etc/ssl/certs/space/tls.pem
CZ_CLUSTER_CERT_KEYFile path to store the Space Agent private key, if not specified defaults to /etc/ssl/certs/space/tls.key

Configuration File Format

The configuration file referenced in the CZ_SPACE_CONFIG environment variable must list the services that you want to access via this Space Agent. Each record consists of the following fields:

FieldDescription
nameThe name of the service
forwardHostThe host to forward consume requests to
namespaceOptional namespace, defaults to default
ports[].portA list of ports that the service is listening on

Below is an example of a configuration file for two services, one on the local host and one on host 10.0.0.2:

- name: service-a
forwardHost: localhost
ports:
- port: 80
- name: service-b
forwardHost: 10.0.0.2
ports:
- port: 80
- port: 443

Example Start Script

Below is a minimal start script for a Space Agent:

#!/bin/sh

export CZ_SPACE_CONFIG=compute-services.yaml
export CZ_EXTERNAL_HOST=`curl https://ifconfig.me`
export CZ_HUB_SPACE_NAME="VM Space"
export CZ_HUB_ORG_ID="xxxxxx"
export CZ_HUB_ORG_APIKEY="xxxxxxx"

./spaceagent