What are tags?
Tags are basically the metadata or labels attached to an object. Each tag consists of a key and an optional value that can make it easier to manage, search for, and filter resources by specific criteria. Commonly used tags are application, environment (staging or production), owner, and so on. For example, you could tag all API services with an API tag, or tag all services where Terraform automation is used with a Terraform tag. Tags are especially important for today's ephemeral environments. For example, hosts live for a short time and have dynamic IP addresses. The IP address of a host may change, but any tags associated with it will persist.
How does Gremlin use tags?
Gremlin recognizes host, cloud, and Kubernetes tags to define the scope of what to evaluate during reliability testing. For example, you might want to test the reliability of a Service running on a certain operating system or in a specific zone.
Zone tags are required for the Zone Reliability Test.
In the Kubernetes world, tags are actually known as labels. (Gremlin does not use Kubernetes annotations.) Using labels will help you match deployments with Services in Gremlin. For more information on Kubernetes labels, see Labels and Selectors.
Cloud providers generally have a set of default tags. Be aware that some cloud providers have a limit on the number of tags you can apply. For more information on cloud tags, see: Tagging AWS resources, Google Tags, and Use tags to organize your Azure resources and management hierarchy.
If you are not using a cloud provider, you will need to define custom tags and be familiar with them when you create a Service in Gremlin. You will also need to assign your custom tags to the Gremlin Agent.
Examples of tags in Gremlin
In the following example for a host Service, the scope of testing will cover the following zones:
In this example for a Kubernetes Service, the
accounts-db StatefulSet will be used to define the scope of testing.
Assign custom tags
Gremlin automatically pulls in Kubernetes, cloud tags, and common host tags such as
operating system. For custom tags, you will need to assign them to the Gremlin Agent. There are 2 ways to assign your custom tags to the Gremlin Agent:
- Use the Gremlin configuration file (config.yaml)
- Use an environment variable
Using the Gremlin configuration file
tags variable in config.yaml.
1tags:2 service: pet-store3 interface: http
See Using the configuration file for more information.
Using an environment variable
GREMLIN_CLIENT_TAGS variable to assign custom tags, separated by comma, to the Gremlin Agent.
See Using environment variables for more information.