Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Gitlab Workspace: Step-by-Step Guide

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

  1. GitLab Premium or Ultimate
  2. A Kubernetes cluster (e.g., GKE, EKS, AKS, Minikube)
  3. Access to the GitLab project
  4. 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

  1. Go to your GitLab project
  2. Navigate to:
    Infrastructure > Kubernetes clusters
    OR
    Settings > CI/CD > GitLab Agent
  3. Click Register a new agent
  4. Give your agent a name, e.g., gitlab-workspace-agent
  5. GitLab will give you a command like: kubectl apply -f https://gitlab.com/api/v4/projects/<PROJECT_ID>/agent_kubernetes_configuration.yaml
  6. 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

  1. Go to Dev > Workspaces
  2. Click New Workspace
  3. Select the correct project and the linked agent
  4. 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


Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x