Enable kubedock in a workspace

Enable kubedock in an OpenShift Dev Spaces workspace by adding environment variables to the devfile.

Before you begin

Procedure

  1. Add KUBEDOCK_ENABLED=true environment variable to the devfile.
  2. Optional: Use the KUBEDOCK_PARAMS variable to specify additional kubedock parameters. The list of parameters is available in the kubedock server source. Alternatively, you can use the following command to view the available options:
    # kubedock server --help
  3. Configure the Podman or docker API to point to kubedock by setting CONTAINER_HOST=tcp://127.0.0.1:2475 or DOCKER_HOST=tcp://127.0.0.1:2475 in the devfile.
    Important

    Configure Podman to point to local Podman when building containers, and to kubedock when running containers.

    The following example devfile enables kubedock with Testcontainers support:

    schemaVersion: 2.2.0
    metadata:
      name: kubedock-sample-devfile
    components:
      - name: tools
        container:
          image: quay.io/devfile/universal-developer-image:latest
          memoryLimit: 8Gi
          memoryRequest: 1Gi
          cpuLimit: "2"
          cpuRequest: 200m
          env:
            - name: KUBEDOCK_PARAMS
              value: "--reverse-proxy --kubeconfig /home/user/.kube/config --initimage quay.io/agiertli/kubedock:0.13.0"
            - name: USE_JAVA17
              value: "true"
            - value: /home/jboss/.m2
              name: MAVEN_CONFIG
            - value: -Xmx4G -Xss128M -XX:MetaspaceSize=1G -XX:MaxMetaspaceSize=2G
              name: MAVEN_OPTS
            - name: KUBEDOCK_ENABLED
              value: 'true'
            - name: DOCKER_HOST
              value: 'tcp://127.0.0.1:2475'
            - name: TESTCONTAINERS_RYUK_DISABLED
              value: 'true'
            - name: TESTCONTAINERS_CHECKS_DISABLE
              value: 'true'
          endpoints:
            - exposure: none
              name: kubedock
              protocol: tcp
              targetPort: 2475
            - exposure: public
              name: http-booster
              protocol: http
              targetPort: 8080
              attributes:
                discoverable: true
                urlRewriteSupported: true
            - exposure: internal
              name: debug
              protocol: http
              targetPort: 5005
          volumeMounts:
            - name: m2
              path: /home/user/.m2
      - name: m2
        volume:
          size: 10G