Importing Kubernetes applications into a workspace

To deploy a new instance of an application in a Che workspace, use one of the following scenarios:

Adding a Kubernetes or OpenShift application to an existing workspace using the dashboard

This procedure demonstrates how to modify an existing workspace and import the Kubernetes or OpenShift application using the newly created devfile.

Prerequisites
  • A running instance of Che. To install an instance of Che, see Installing Che.

  • An existing workspace defined on this instance of Che.

Procedure
  1. After the creation of a workspace, use the Workspace menu and then click on the desired workspace.

  2. Modify the workspace devfile, use the Devfile tab.

  3. Add a Kubernetes or OpenShift component.

  4. For the changes to take effect, save the devfile and restart the Che workspace.

Generating a devfile from an existing Kubernetes or OpenShift application

This procedure demonstrates how to generate a devfile from an existing Kubernetes or OpenShift application using the chectl tool.

Prerequisites
Procedure
  1. To generate a devfile, use:

    $ chectl devfile:generate
    • It is also possible to generate a devfile from, for example, the NodeJS-MongoDB application that includes the NodeJS component, using the chectl devfile:generate command:

      Example:
      $ chectl devfile:generate --selector="app=nodejs"
      apiVersion: 1.0.0
      metadata:
        name: chectl-generated
      components:
        - type: kubernetes
          alias: app=nodejs
          referenceContent: |
            kind: List
            apiVersion: v1
            metadata:
              name: app=nodejs
            items:
              - apiVersion: apps/v1
                kind: Deployment
                metadata:
                  labels:
                    app: nodejs
                  name: web
      (...)

      The Node.js application YAML definition is available in the devfile, inline, using the referenceContent attribute.

    • To include support for a language, use the --language parameter:

      $ chectl devfile:generate --selector="app=nodejs" --language="typescript"
      apiVersion: 1.0.0
      metadata:
        name: chectl-generated
      components:
        - type: kubernetes
          alias: app=nodejs
          referenceContent: |
            kind: List
            apiVersion: v1
      (...)
        - type: chePlugin
          alias: typescript-ls
          id: che-incubator/typescript/latest
  2. Use the generated devfile to start a Che workspace with chectl.

    $ chectl workspace:start --devfile=devfile​.yaml