Light Dark Auto

Create and Deploy a Tenant Service

Generate a GSL service file using the CLI and deploy it into the mesh

Introduction

All services deployed into greymatter require a corresponding GSL service file containing that service’s application networking configurations. The greymatter init service CLI command generates a configuration file and is the fastest method for integrating the service into the mesh.

This guide will show you how to deploy a service into the mesh by using the auto-generated configurations produced by the init service command. By the end of this guide, your service will be running in the mesh, reporting metrics and request audits, and fully routable from the application edge node.

Prerequisites

  • A greymatter 1.8.x installation.
  • A greymatter tenant project. Follow this guide to set one up.

1. Generate the GSL Service File

In your terminal, navigate to the GSL project you want to initialize a service in. Run the command:

greymatter init service -n <project name> --dir greymatter/<service folder> -t <type of service>  -p <service port> <service name>

There are three types of services:

  • tcp
  • http
  • lambda

Each one will change the type of default listener produced by the command.

You can choose any name for the service folder name. If you service is organized under some greater application, then a useful pattern is to choose a folder that describes that application. For instance, a dashboard application could have a folder named dashboard with the service files dashboard.cue, database.cue, backend.cue.

After running the command, verify that the service folder contains a new CUE file matching the service name.

3. Enable Sidecar Injection

Navigate to your service’s Kubernetes manifest. Open it and add a new annotation to the metadata.annotations object: greymatter.io/inject-sidecar-to: 10808

This special annotation tells greymatter Operator to inject a greymatter data plane proxy container into your Kubernetes resource.

4. Push the GSL Configuration

Everything is setup to begin the deployment. Start by validating your configurations are correct by running from the root of the project:

greymatter sync --dry-run

The command will log any errors it encountered during validation.

Correct any errors, if there are any, and commit and push your changes:

git add .
git commit -m "Add new service"
git push

5. Deploy Your Service

Deploy your service into the Kubernetes cluster while you wait for the sync service to finish. Track it’s status by running:

kubectl get pods -n <project namespace> -w

You should see it get deleted and replaced by a Pod of the same name but with one more container than it had before (this is the operator injecting a data plane proxy).

6. Validate the Configurations

Navigate to your service by loading the URL in the browser or through a tool like curl. The service should be accessible at a URL with the form: https://<edge service external ip>:<edge service port>/services/<project namespace>/<service name>.

Conclusion

Your service is now successfully deployed and integrated into greymatter. Follow this process again when you want to deploy another one.

Next Steps