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.
- v4 API:
- GitLab API: https://docs.gitlab.com/api/cluster_agents
List cluster agents for a project:
cluster_agents = project.cluster_agents.list(get_all=True)
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()