You’re encountering the error:
โYou can’t create a workspace for this project โ No agents available to create workspaces.โ
This means your project is missing a GitLab Agent for Kubernetes, which is required for GitLab Workspaces.
โ Step-by-Step Guide to Set Up GitLab Workspaces
๐ What Is a Workspace?
A Workspace in GitLab is a cloud-based dev environment (similar to GitHub Codespaces), but it needs:
- A configured GitLab Agent for Kubernetes
- A linked Kubernetes cluster
๐ง Prerequisites
- GitLab Premium or Ultimate
- A Kubernetes cluster (e.g., GKE, EKS, AKS, Minikube)
- Access to the GitLab project
- You are an Owner or Maintainer of the project
๐งญ STEP 1: Create a Kubernetes Cluster (if you donโt have one)
You can use:
- GKE: Google Kubernetes Engine
- EKS: Amazon Elastic Kubernetes Service
- AKS: Azure Kubernetes Service
- Minikube: Local dev cluster
๐งญ STEP 2: Install GitLab Agent for Kubernetes
- Go to your GitLab project
- Navigate to:
Infrastructure > Kubernetes clusters
ORSettings > CI/CD > GitLab Agent - Click Register a new agent
- Give your agent a name, e.g.,
gitlab-workspace-agent - GitLab will give you a command like:
kubectl apply -f https://gitlab.com/api/v4/projects/<PROJECT_ID>/agent_kubernetes_configuration.yaml - Copy that command and run it in your Kubernetes cluster
๐งญ STEP 3: Configure .gitlab/agents/<agent-name>/config.yaml
Create this file in your repo:
ci_access:
# Allow CI/CD jobs to access the cluster
projects:
- id: your-group/your-project
Code language: PHP (php)
Commit this file to the repository under:
.gitlab/agents/gitlab-workspace-agent/config.yaml
๐งญ STEP 4: Enable Workspaces
- Go to Dev > Workspaces
- Click New Workspace
- Select the correct project and the linked agent
- GitLab will now initialize a dev environment in your Kubernetes cluster
๐งช Troubleshooting That Exact Error
โ โNo agents available to create workspacesโ
โ You must:
- Have a GitLab Agent registered to this project
- Have committed the agent config file to the correct path
- Be using GitLab SaaS or a GitLab instance that supports Workspaces
๐ Official Docs
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals