This workshop deploys compute, storage, networking, and an IoT application to metal.equinix.com.
This repository is Experimental meaning that it's based on untested ideas or techniques and not yet established or finalized or involves a radically new and innovative style! This means that support is best effort (at best!) and we strongly encourage you to NOT use this in production.
Diagram:
Private components:
- Kubernetes - provisioned with Terraform
- TLS termination - via cert-manager
- MQTT Connector - openfaas-incubator/mqtt-connector
- Database/storage - Postgresql
- Docker registry - deployed externally, i.e. the Docker Hub.
Components exposed with TLS / Ingress or NodePort:
- Ingress Controller - Traefik v1 (HostPort 80/443)
- Serverless compute platform - OpenFaaS
- MQTT Broker - emitter.io (NodePort) - 30080/30443
- Business intelligence - Metabase (Ingress/TLS)
- Metrics visualization - Grafana (Ingress/TLS)
Before you begin using this repo you will need an Equinix Metal account.
Everything else you need to deploy this workshop is available in this repository.
Note: This repository is designed to be used with your own domain name and a number of DNS records. This enables TLS termination (HTTPS) to be used for exposed services. If you are working in development, you can skip the domain and TLS steps.
You can register for a domain at Google Domains or Namecheap.com for a few dollars. You can also configure your domain there, after purchase.
git clone https://github.com/equinix-labs/metal-iot
You will need to install Terraform for this step.
-
Set your Equinix Metal API and project ID in a terraform.tfvar file in
/k8s
. -
Enter the
k8s
folder and apply the terraform plan. -
Find the IP of one of the nodes in the cluster from your Equinix Metal dashboard or the state file in /k8s/
Create four DNS A records (replace example.com
with your domain):
- A
gateway.example.com
- IP - A
grafana.example.com
- IP - A
metabase.example.com
- IP - A
emitter.example.com
- IP
Some commands will be run from your laptop, so make sure you install Kubectl
You will need to install helm for this step.
- Install postgresql
-
Install openfaas to provide compute and events
-
Deploy the OpenFaaS services for the application
You will also deploy the schema.sql at this time for drone_position
and drone_event
.
-
Install cert-manager
k3sup app install cert-manager
-
Install an Ingress record for your OpenFaaS gateway
k3sup app install openfaas-ingress \ --domain gateway.example.com \ --email [email protected] \ --ingress-class traefik
-
Add TLS for Grafana
Edit
./openfaas/grafana-ingress.yaml
and editgrafana.example.com
replacingexample.com
with your domain.Now run:
kubectl apply -f ./openfaas/grafana-ingress.yaml
- Install emitter
The MQTT-Connector is used to trigger functions and services in response to messages generated by the event source. It runs inside the Kubernetes cluster and is private with no ingress.
- Install OpenFaaS MQTT-Connector
Grafana packages a pre-compiled dashboard for OpenFaaS to show metrics like throughput and latency.
You can now send data to emitter from your drone clients. Use the drone simulator to generate realistic data for use with visualization tools.