In this guide we will go through the ioFog platform supporting tools. By the end of this guide we will have a set infrastructure necessary for deployment of Edge Compute Networks (ECNs) including machines for ioFog Agents. This guide is tied to ioFog platform repository.
We use Terraform to deploy all infrastructure and iofogctl to configure remote edge nodes to install agent software on. The infrastructure uses
The platform project spins up an infrastructure stack which consists of:
After the infrastructure setup, we can deploy Edge Compute Network (ECN) on the GKE cluster using iofogctl.
In order to setup the infrastructure and then install ECN and Agents, we will need the following tools:
To then install a complete EdgeCompute Network (ECN), we will also need
We don't have to install these tools manually now. Later in the process, we will use a script to download those dependencies and initialise terraform variable file.
In this section, we will retrieve a service account for GCP that will be later used to spin up infrastructure.
First, we need to setup gcloud with our project. We can either establish a service account or use a personal account with GCP. In both cases, the minimal set of IAM roles required is:
To login with a service account and setup our project, first download the service account key file from GCP, then run the authenticate gcloud with the service account. Further details on how to setup a service account are available in the GCP documentation.
You can test authenticate gcloud with the newly created service account.
gcloud auth activate-service-account --key-file=service-account-key.json
If you no longer have the service account key file, it is possible to generate another key using gcloud or using the GCP console.
The platform tools also supports deployment of agent nodes on packet. This step is entirely optional and is it possible to provide our own machines for ioFog Agents instead.
In this section we will retrieve a Packet API Token that will be later used for spinning up machines for ioFog Agents.
We will need Packet token to setup packet provider on terraform. First we have to upload our ssh key that will be used by automation to add to newly created instances.
Next, retrieve a Packet auth token and project ID from Packet website and save it for later.
Let's get started with the platform tools now by cloning the ioFog platform repository repository.
git clone email@example.com:eclipse-iofog/platform.git cd platform
We can then run bootstrap to install all the required tools. It is possible to skip the installation step if we opt to instead provide the tools ourselves, please consult
./bootsrap.sh --help for details.
Here we use the GCP service account key we have previously obtained in Google Cloud Platform Setup section.
./bootstrap.sh --gcloud-service-account service-account-key.json
It is also possible to authenticate using a personal GCP account by running
./bootstrap.sh only, but this is not recommended.
First create a copy of the variables template file.
cp infrastructure/gcp/template.tfvars user.tfvars
Now we have to edit the
user.tfvars file according to our credentials and desired infrastructure. There are three main sections in the file: general variables, agents list and packet variables. Let's start by modifying the following general variables:
||Path to the service account key file from Google Cloud Platform Setup|
||Name of the GCP service account|
||GCP project ID|
||Name of the infrastructure (to identify the resources on GCP and Packet)|
||Region if GCP infrastructure|
||Packet API key from Packet Setup (Optional) (Optional)|
||Packet project ID (Optional)|
||Packet operating system of all agents (Optional)|
||Packet regions (called facilities) (Optional)|
||Packet number of x86 instances (Optional)|
||Packet plan of x86 instances (Optional)|
||Packet number of arm instances (Optional)|
||Packet plan of arm instances (Optional)|
To deploy the new infrastructure, run:
Once the infrastructure is successfully deployed, we should be able to interact with the Kubernetes cluster. Terraform automatically setup our kubeconfig for us. To use the newly created Kubernetes cluster, we need to define
KUBECONFIG environment variable to point to a kubeconfig file created by Terraform. The kubeconfig file is always in
<environemnt> corresponds to the settings passed in our
Should we need to retrieve kubeconfig for our new cluster anytime in the future or from another machine, we can use
gcloud container clusters get-credentials environment --region gcp_region, where
gcp_region refer to previously described variables.
kubectl get no to list all nodes available to the cluster. These will also includes our edge Agents as nodes.
Now that the infrastructure is up, we can deploy our first ECN on the infrastructure. We are going to use
iofogctl for this purpose.
We start by editing the generated
ecn.yaml file according to iofogctl specification. Most important are
keyfile parameters. The
kubeconfig variable is the same as in Interact With Newly Deployed Infrastructure.
keyfile refers to a private SSH key to access the given agent. For Packet agents, these must be uploaded to Packet according to Packet Setup (Optional). This is also where we can add additional agents (outside of the new infrastructure).
--- apiVersion: iofog.org/v1 kind: ControlPlane metadata: name: albatros spec: iofogUser: name: John surname: Doe email: firstname.lastname@example.org password: '#Bugs4Fun' controllers: - name: ctrl kube: config: infrastructure/gcp/release-1-3-0.kubeconfig replicas: 1 serviceType: LoadBalancer --- apiVersion: iofog.org/v1 kind: Connector metadata: name: connector spec: kube: config: infrastructure/gcp/release-1-3-0.kubeconfig replicas: 1 --- apiVersion: iofog.org/v1 kind: Agent metadata: name: agent-0 spec: host: 126.96.36.199 ssh: user: root keyFile: ~/.ssh/id_ecdsa --- apiVersion: iofog.org/v1 kind: Agent metadata: name: agent-1 spec: host: 188.8.131.52 ssh: user: root keyFile: ~/.ssh/id_ecdsa
Once we are happy with the file, we can deploy the ECN:
iofogctl -n platform-ecn deploy -f ecn.yaml
To destroy the infrastructure (and all deployed ECNs), run:
Make sure the
tfvars file is the same for both deploy and destroy invocations.