Create a Tenant GSL Service
  • 21 Mar 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Create a Tenant GSL Service

  • Dark
    Light
  • PDF

Article summary

Generate the GSL Service File

We will use the init service command to generate just a GSL service file.

Open your terminal. Navigate to the GSL project that should contain the new service.

Generate a new service file with:

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

The project name flag (-n) should contain the name of the GSL project. Set the service type flag (-t) to the type of traffic the service will handle (if more than two types, pick the type that corresponds to the most important type). There are four types of services:

  • tcp

  • http

  • lambda

  • udp

Each one will change the primary listener produced by the command.

Set the service port to the port where the application is listening on. The directory flag (—dir) changes where the CLI outputs the templated file. The CLI will default to the current directory. Place the generated file in subdirectory of greymatter that makes sense to your needs. Project generation created a folder named the project that should suffice for simple operations.

Finally, enter the service name. The value of the service name is critical. Greymatter uses it to link the configuration to the deployed service. The value must match the name of the Kubernetes workload.

To view the init command in more detail, check out this page or the help command.

Annotate the Kubernetes Manifest

The Greymatter Operator will inject a data plane proxy in a sidecar configuration only if the deployed service contains a specific annotation. Open the Kubernetes manifest used for your service and insert the annotation (adding the metadata.annotations block if it doesn’t exist):

metadata:
  annotations:
    greymatter.io/inject-sidecar-to: "9080"

Apply the changes

Apply all your changes by adding and committing your configuration. Sync will pick up the new commit and send it to mesh.

Re-deploy your service with the new annotations using whatever method you normally use to manage its Kubernetes deployment.

If everything was successful, you should see an extra container get injected into your deployment.


Was this article helpful?