Cluster agents

You can list and manage project cluster agents with the GitLab agent for Kubernetes.

Warning

Check the GitLab API documentation linked below for project permissions required to access specific cluster agent endpoints.

Reference

Examples

List cluster agents for a project:

cluster_agents = project.cluster_agents.list()

Register a cluster agent with a project:

cluster_agent = project.cluster_agents.create({"name": "Agent 1"})

Retrieve a specific cluster agent for a project:

cluster_agent = project.cluster_agents.get(cluster_agent.id)

Delete a registered cluster agent from a project:

cluster_agent = project.cluster_agents.delete(cluster_agent.id)
# or
cluster.delete()