{"id":49555,"date":"2025-05-28T08:49:50","date_gmt":"2025-05-28T08:49:50","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=49555"},"modified":"2025-05-28T08:49:50","modified_gmt":"2025-05-28T08:49:50","slug":"gitlab-workspace-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/gitlab-workspace-step-by-step-guide\/","title":{"rendered":"Gitlab Workspace: Step-by-Step Guide"},"content":{"rendered":"\n<p>You&#8217;re encountering the error:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u201cYou can&#8217;t create a workspace for this project \u2013 No agents available to create workspaces.\u201d<\/strong><\/p>\n<\/blockquote>\n\n\n\n<p>This means your project is missing a <strong>GitLab Agent for Kubernetes<\/strong>, which is <strong>required<\/strong> for GitLab Workspaces.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 Step-by-Step Guide to Set Up GitLab Workspaces<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udccc What Is a Workspace?<\/h3>\n\n\n\n<p>A <strong>Workspace<\/strong> in GitLab is a <strong>cloud-based dev environment<\/strong> (similar to GitHub Codespaces), but it needs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A configured <strong>GitLab Agent for Kubernetes<\/strong><\/li>\n\n\n\n<li>A linked <strong>Kubernetes cluster<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd27 Prerequisites<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>GitLab Premium or Ultimate<\/strong><\/li>\n\n\n\n<li>A <strong>Kubernetes cluster<\/strong> (e.g., GKE, EKS, AKS, Minikube)<\/li>\n\n\n\n<li>Access to the <strong>GitLab project<\/strong><\/li>\n\n\n\n<li>You are an <strong>Owner<\/strong> or <strong>Maintainer<\/strong> of the project<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udded STEP 1: Create a Kubernetes Cluster (if you don\u2019t have one)<\/h2>\n\n\n\n<p>You can use:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GKE: Google Kubernetes Engine<\/li>\n\n\n\n<li>EKS: Amazon Elastic Kubernetes Service<\/li>\n\n\n\n<li>AKS: Azure Kubernetes Service<\/li>\n\n\n\n<li>Minikube: Local dev cluster<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udded STEP 2: Install GitLab Agent for Kubernetes<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Go to your GitLab project<\/strong><\/li>\n\n\n\n<li>Navigate to:<br><code>Infrastructure > Kubernetes clusters<\/code><br>OR<br><code>Settings > CI\/CD > GitLab Agent<\/code><\/li>\n\n\n\n<li>Click <strong>Register a new agent<\/strong><\/li>\n\n\n\n<li>Give your agent a name, e.g., <code>gitlab-workspace-agent<\/code><\/li>\n\n\n\n<li>GitLab will give you a command like: <code>kubectl apply -f https:\/\/gitlab.com\/api\/v4\/projects\/&lt;PROJECT_ID>\/agent_kubernetes_configuration.yaml<\/code><\/li>\n\n\n\n<li>Copy that command and <strong>run it in your Kubernetes cluster<\/strong><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udded STEP 3: Configure <code>.gitlab\/agents\/&lt;agent-name&gt;\/config.yaml<\/code><\/h2>\n\n\n\n<p>Create this file in your repo:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">ci_access:\n  <span class=\"hljs-comment\"># Allow CI\/CD jobs to access the cluster<\/span>\n  projects:\n    - id: your-group\/your-project\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Commit this file to the repository under:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">.gitlab\/agents\/gitlab-workspace-agent\/config.yaml\n<\/code><\/span><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udded STEP 4: Enable Workspaces<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Dev > Workspaces<\/strong><\/li>\n\n\n\n<li>Click <strong>New Workspace<\/strong><\/li>\n\n\n\n<li>Select the correct <strong>project<\/strong> and the linked <strong>agent<\/strong><\/li>\n\n\n\n<li>GitLab will now initialize a dev environment in your Kubernetes cluster<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddea Troubleshooting That Exact Error<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u274c \u201cNo agents available to create workspaces\u201d<\/p>\n<\/blockquote>\n\n\n\n<p>\u2705 <strong>You must:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Have a GitLab Agent registered to this project<\/li>\n\n\n\n<li>Have committed the agent config file to the correct path<\/li>\n\n\n\n<li>Be using GitLab SaaS or a GitLab instance that supports Workspaces<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcdd Official Docs<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.gitlab.com\/ee\/workspaces\/\" target=\"_blank\" rel=\"noopener\">GitLab Workspaces Overview<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/docs.gitlab.com\/ee\/user\/clusters\/agent\/\" target=\"_blank\" rel=\"noopener\">GitLab Kubernetes Agent Setup<\/a><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You&#8217;re encountering the error: \u201cYou can&#8217;t create a workspace for this project \u2013 No agents available to create workspaces.\u201d This means your project is missing a GitLab Agent for Kubernetes,&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-49555","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/49555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=49555"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/49555\/revisions"}],"predecessor-version":[{"id":49556,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/49555\/revisions\/49556"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=49555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=49555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=49555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}