theonedev/onedev · error · ExplicitException

OneDev running inside kubernetes cluster does not support wo

Error message

OneDev running inside kubernetes cluster does not support workspaces yet

What it means

ServerDockerProvisioner.checkApplicable throws ExplicitException when OneDev is running inside a Kubernetes cluster (OneDev.getK8sService() != null). The server-docker workspace provisioner only works when OneDev runs on a plain server/host, not in k8s.

Source

Thrown at server-plugin/server-plugin-provisioner-serverdocker/src/main/java/io/onedev/server/plugin/provisioner/serverdocker/ServerDockerProvisioner.java:258

	}

	private List<RegistryLoginFacade> getRegistryLoginFacades(String token) {
		return getRegistryLogins().stream()
				.map(it -> it.getFacade(token))
				.collect(toList());
	}

	protected List<RegistryLoginFacade> getAllRegistryLogins(WorkspaceContext context) {
		var provisionerRegistryLogins = getRegistryLoginFacades(context.getToken());
		var registryLogins = context.getSpec().getRegistryLogins().stream()
				.map(it -> new RegistryLoginFacade(it.getRegistryUrl(), it.getUserName(), it.getPassword()))
				.collect(toList());
		return merge(registryLogins, provisionerRegistryLogins);
	}

	private void checkApplicable() {
		if (OneDev.getK8sService() != null) {
			throw new ExplicitException("OneDev running inside kubernetes cluster does not support workspaces yet");
		}
	}

	@Override
	public void test(TestData testData, TaskLogger jobLogger) {
		checkApplicable();
		var docker = newDocker();
		AgentUtils.testDocker(docker, getRegistryLoginFacades(testData.getDockerImage()),
				testData.getDockerImage(), getCpuLimit(), getMemoryLimit(), getRunOptions(),
				this::getHostPath, jobLogger);
	}

	@Editable(name="Specify a Docker Image to Test Against")
	public static class TestData implements Serializable {

		private static final long serialVersionUID = 1L;

		private String dockerImage;

View on GitHub (pinned to d44925c47c)

Solutions

  1. Use the Kubernetes-aware execution mode (k8s executors/pods) instead of server docker workspaces
  2. If workspaces are required, run OneDev outside kubernetes (bare VM/docker host install)
  3. If OneDev is NOT actually in k8s but reports k8sService non-null, verify deployment environment settings

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

if (OneDev.getK8sService() != null) { throw new IllegalStateException('Server docker workspaces require OneDev outside kubernetes'); }

Try / catch

try { provisioner.test(testData, logger); } catch (ExplicitException e) { if (e.getMessage().contains('kubernetes')) useK8sNativeExecutor(); else throw e; }

Prevention

When it happens

Trigger: Configuring a workspace/CI step to use the Server Docker provisioner while the OneDev instance itself is deployed inside a Kubernetes cluster; calling test() or provision() in that state.

Common situations: OneDev deployed via the official k8s Helm/operator setup, then attempting to use server docker workspaces; migrating an existing server-docker config to a k8s deployment.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/cd5e0bc151218a45. Report an issue: GitHub.