How to Rotate a CircleCI Container Runner Token and Delete Resource Class


In this support article, we will walk through the steps for rotating a CircleCI runner token and deleting a resource class using the CircleCI CLI.

Note: Deleting a Resource Class is only possible after all the tokens associated with it have been removed, if not, you may encounter an error message like error: resource class still has tokens in use


Before you begin, ensure you have the CircleCI CLI installed and configured in your system.

Rotating Runner Token and Deleting Resource Class

Follow the steps below to rotate a token and delete a resource class:

1. List Runner Tokens

First, list all the runner tokens associated with the resource class:

circleci runner token list <resource-class>

2. Delete Runner Token

Next, delete the desired token by using the token ID returned from the list command:

circleci runner token delete <token-id>

3. Delete Resource Class or Create New Token

At this point, you can either delete the Resource Class, create a new Runner Token or do both.


Delete the Resource Class

Use the following command to delete the resource class:

circleci runner resource-class delete <resource-class>


Create a New Token

If you need a new token for the same resource class, run the following command:

circleci runner token create <resource-class> <nickname>


This new token should be updated in your values.yaml file or in your secrets manager if you are using one. For example:

helm upgrade container-agent container-agent/container-agent -n circleci -f values.yaml


Please Note: The process to rotate the runner's token requires a new token generation and the replacement of the old token in all places it was used including configuration files and environment variables. Taking proper precautions to keep these tokens secure is paramount for maintaining a safe and efficient CI/CD environment.


Additional Resources

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.