Skip to main content

Add your first Environment: the engine, the gateway address and the connection test

Connect a gateway cluster to the console: Admin API and sealed key, gateway address, Prometheus, the five refusals the connection test names, the audit record.

By Efsun Balcı Getting started

What you will have at the end

An Environment named Sandbox that manages one gateway cluster: its Admin API address and admin key, stored sealed and never shown again; the address your API consumers call; a Prometheus for Analytics. Before you save, the connection test tells you in one sentence what is wrong when something is, and this article shows five of its answers: a rejected key, a closed port, a host that does not resolve, a timeout and a certificate the console does not trust. The creation is a record in the platform audit log, and the Environment is marked protected, which is what keeps a tired hand from deleting it.

Prerequisites

  • A running gateway cluster and its Admin API: the address and the admin key its configuration carries. The cluster of this article is a fresh one with no Routes, reachable from the console at 127.0.0.1:9380, with its data plane at 127.0.0.1:9381.
  • Optional: a Prometheus that scrapes the cluster, here at 127.0.0.1:9092, and an Elasticsearch or OpenSearch for request records. The log store is left out here; the Traffic Explorer article of this series connects one.
  • A role that may manage Environments. The screenshots below were taken as nora.becker on the lab install, which already manages Staging and Production; on your install the list holds the Environment of the first article.

Adding an Environment does not touch the engine: the list page says so, and it is worth repeating. G8 manages what is already running.

The form

Open Environments in the platform navigation and select Add environment. Under General, Name Sandbox and Slug sandbox: three to thirty-two lowercase letters, digits and hyphens, part of every address and of every record name, and it cannot change once created. Under Engine:

  • Admin API URL: http://127.0.0.1:9380, where G8 reads and writes the gateway.
  • Admin key: sent as X-API-KEY, stored sealed, not shown again after you save. The eye icon shows it only while you type.
  • Gateway URL: http://127.0.0.1:9381, the address API consumers call. It is shown on every Route and checked by the connection test.
  • CA certificates: a PEM bundle, used for every HTTPS connection of this Environment, the Admin API, the gateway, the log store and Prometheus. Empty here, because the lab cluster speaks plain HTTP.

What the connection test says

The Test connection button under the Engine section tests the values as typed, before anything is saved. Each answer is one sentence a person can act on, with the raw reason under it.

A key that is not the cluster’s:

The Engine section of the new-environment form with Admin API URL http://127.0.0.1:9380, the Admin key masked, and the test result: Admin API, a red dot, The engine rejected the admin key, with the raw reason 401 · failed to check token · wrong apikey The engine answered, and said no. The key is wrong, the address is right.

A port where nothing listens, http://127.0.0.1:9385, is answered with Connection refused at 127.0.0.1:9385. and the dial error under it. A host name that does not exist, engine.sandbox.invalid, is answered with Host engine.sandbox.invalid could not be resolved. An address that swallows packets, 10.255.255.1:

The same section with Admin API URL http://10.255.255.1:9180 and the result: Timed out after 2 s waiting for 10.255.255.1:9180, with the raw reason context deadline exceeded Two seconds, then the answer. A firewall that drops instead of refusing looks like this.

And an HTTPS address whose certificate was signed by a CA the console does not hold, a small server on 127.0.0.1:9449 set up for the measurement:

The same section with Admin API URL https://127.0.0.1:9449 and the result: Certificate not trusted. Paste the CA that signed it under CA certificates, with the raw reason x509: certificate signed by unknown authority The sentence names the field that fixes it. Your own CA goes under CA certificates and applies to every connection of the Environment.

With the right address and key, and the Gateway URL filled in:

The Engine section with the right values and two green rows: Admin API, Connected with the engine's version 3.19.0 and a Verified pill, 0 routes · 186 ms; and Data plane, Reachable · answers as the engine Two rows: the Admin API answered with its version, which is the one this release was verified against, and the gateway address answers as the same engine.

The version matters: a cluster on another version is still managed, and the console marks it Unverified wherever the engine is shown, so a reader of the Environments list knows the forms were drawn for a different version.

Observability, optional

Under Observability, the log store and Prometheus each have their own Test connection. The article fills Prometheus URL with http://127.0.0.1:9092:

The Observability section: Elasticsearch URL, Username and Password empty, Prometheus URL http://127.0.0.1:9092 and the result Connected · Prometheus 3.15.0 · no series labelled g8_environment=sandbox yet, with the note under it listing Elasticsearch indices g8-sandbox-access-* and Prometheus label g8_environment="sandbox" Connected, and an amber dot: the Prometheus is there, but nothing carries this Environment’s label yet, because the cluster has served no request.

The note under the fields is the naming rule of the product: the request records of this Environment will live in indices named g8-sandbox-access-*, and its metrics under the label g8_environment="sandbox". Both follow the slug and are not edited anywhere.

Save

The Changes panel on the right shows what the form sends, with the key masked:

The Changes panel, To be created: a JSON object with description, engine_admin_key as four dots, engine_admin_url http://127.0.0.1:9380, gateway_url http://127.0.0.1:9381, id sandbox, name Sandbox, prometheus_url http://127.0.0.1:9092 and protected false What reaches the server when you save, as the audit log will record it. The key is the one value that is already masked here.

Select Create environment. The list shows the new row with its engine status from the same probe as the Overview card, and a banner that says who can open it: users with a role in all Environments can, everyone else needs a role in Sandbox.

The Environments list after the save: three rows, Staging, Production with a Protected pill, and Sandbox, Reachable · 3.19.0 · 41 ms, with green Gateway and amber Prometheus connection dots, and the banner Sandbox is ready One install, one engine cluster per row. The amber Prometheus dot will turn green with the first scraped request.

What the audit log keeps

The creation is an environment.created record in the Platform audit log: who, when, from which address, and under Details what was set, as booleans. The key is not in it.

The platform audit record Environment added · Success: Event with the action environment.created, Actor nora.becker from a local session, Target Environment Sandbox with id sandbox, Request with its id and IP address, and the top of the Details card The record says what was set, not the key: Details holds ca_bundle false, gateway true, the name and, under observability, elasticsearch false, with prometheus below the fold.

The connection tests before the save are records too, environment.tested, one for each click on Test connection: two clicks on Staging’s form, one for the log store and one for Prometheus, left two Connection test rows a few seconds apart.

Mark it protected

Open the row’s menu, Edit, and switch Protected on under Protection; the help says what changes: destructive actions in this Environment ask for the resource name before they run, and nothing else. Save. The row carries a Protected pill, and the menu shows the second effect, which the help does not mention:

The Sandbox row's menu with Edit, Test connection, Unprotect and a greyed-out Delete environment, with the note Unprotect Sandbox first A protected Environment cannot be deleted at all. Unprotect is a separate, audited step, and only then does Delete become available.

Every change here is a record: environment.protected_changed, and a delete, once unprotected, is environment.deleted.

What to do next

Written by
Efsun Balcı
Engineering intern, G8
Was this helpful?
Next step

See G8 in a demo

We’ll show you the console with APIs and AI traffic like yours, and answer the questions these articles leave open.

  1. 01Demo
  2. 02Proof of conceptOn Docker for a quick start, or on the infrastructure you plan to run G8 on.
  3. 03LicenseWe prepare a quote for your edition and nodes, and you receive a signed license file.