Network Tags
What are tags?
Tags are metadata or labels attached to an object, such as a host, container, or Kubernetes resource. Each tag has a key and an optional value. This can make it easier to manage, search for, and filter resources by specific criteria.
Tags are commonly used to identify applications, environments (staging or production), owners, 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, where resources (like hosts and containers) 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.
In Kubernetes, tags are known as labels. 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:
- AWS: Tagging AWS resources
- Azure: Use tags to organize your Azure resources and management hierarchy
- Google Cloud: Google Tags
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: <span class="code-class-custom">us-east-1a</span>, <span class="code-class-custom">us-east1b</span>, and <span class="code-class-custom">us-east-1c</span>.
In this example for a Kubernetes Service, the <span class="code-class-custom">accounts-db</span> StatefulSet will be used to define the scope of testing.
Assigning custom tags
Gremlin automatically pulls in Kubernetes, cloud tags, and common host tags such as <span class="code-class-custom">operating system</span>. 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
Use the <span class="code-class-custom">tags</span> variable in config.yaml. For example:
See Configuring the Gremlin agent for more information.
Using an environment variable
Use the <span class="code-class-custom">GREMLIN_CLIENT_TAGS</span> variable to assign custom tags, separated by comma, to the Gremlin Agent.
For example:
See Using environment variables for more information.