Este conteúdo não está disponível no idioma selecionado.

Chapter 8. Web terminal


8.1. Installing the web terminal

You can install the web terminal by using the Web Terminal Operator listed in the OpenShift Container Platform OperatorHub. When you install the Web Terminal Operator, the custom resource definitions (CRDs) that are required for the command line configuration, such as the DevWorkspace CRD, are automatically installed. The web console creates the required resources when you open the web terminal.

Prerequisites

  • You are logged into the OpenShift Container Platform web console.
  • You have cluster administrator permissions.

Procedure

  1. In the Administrator perspective of the web console, navigate to Operators OperatorHub.
  2. Use the Filter by keyword box to search for the Web Terminal Operator in the catalog, and then click the Web Terminal tile.
  3. Read the brief description about the Operator on the Web Terminal page, and then click Install.
  4. On the Install Operator page, retain the default values for all fields.

    • The fast option in the Update Channel menu enables installation of the latest release of the Web Terminal Operator.
    • The All namespaces on the cluster option in the Installation Mode menu enables the Operator to watch and be available to all namespaces in the cluster.
    • The openshift-operators option in the Installed Namespace menu installs the Operator in the default openshift-operators namespace.
    • The Automatic option in the Approval Strategy menu ensures that the future upgrades to the Operator are handled automatically by the Operator Lifecycle Manager.
  5. Click Install.
  6. In the Installed Operators page, click the View Operator to verify that the Operator is listed on the Installed Operators page.

    Note

    The Web Terminal Operator installs the DevWorkspace Operator as a dependency.

  7. After the Operator is installed, refresh your page to see the command line terminal icon ( odc wto icon ) in the masthead of the console.

8.2. Configuring the web terminal

You can configure timeout and image settings for the web terminal, either for your current session or for all user sessions if you are a cluster administrator.

8.2.1. Configuring the web terminal timeout for a session

You can change the default timeout period for the web terminal for your current session.

Prerequisites

  • You have access to an OpenShift Container Platform cluster that has the Web Terminal Operator installed.
  • You are logged into the web console.

Procedure

  1. Click the web terminal icon ( odc wto icon ).
  2. Optional: Set the web terminal timeout for the current session:

    1. Click Timeout.
    2. In the field that appears, enter the timeout value.
    3. From the drop-down list, select a timeout interval of Seconds, Minutes, Hours, or Milliseconds.
  3. Optional: Select a custom image for the web terminal to use.

    1. Click Image.
    2. In the field that appears, enter the URL of the image that you want to use.
  4. Click Start to begin a terminal instance using the specified timeout setting.

8.2.2. Configuring the web terminal timeout for all users

You can use the Administrator perspective of the web console to set the default web terminal timeout period for all users.

Prerequisites

  • You have cluster administrator permissions and are logged in to the web console.
  • You have installed the Web Terminal Operator.

Procedure

  1. In the Administrator perspective, navigate to Administation Cluster Settings.
  2. On the Cluster Settings page, click the Configuration tab.
  3. On the Configuration page, click the Console configuration resource with the description operator.openshift.io.

    Image of the Configuration page showing the correct Console configuration resource to select
  4. From the Action drop-down list, select Customize, which opens the Cluster configuration page.
  5. Click the Web Terminal tab, which opens the Web Terminal Configuration page.
  6. Set a value for the timeout. From the drop-down list, select a time interval of Seconds, Minutes, Hours, or Milliseconds.
  7. Click Save.

8.2.3. Configuring the web terminal image for a session

You can change the default image for the web terminal for your current session.

Prerequisites

  • You have access to an OpenShift Container Platform cluster that has the Web Terminal Operator installed.
  • You are logged into the web console.

Procedure

  1. Click the web terminal icon ( odc wto icon ).
  2. Click Image to display advanced configuration options for the web terminal image.
  3. Enter the URL of the image that you want to use.
  4. Click Start to begin a terminal instance using the specified image setting.

8.2.4. Configuring the web terminal image for all users

You can use the Administrator perspective of the web console to set the default web terminal image for all users.

Prerequisites

  • You have cluster administrator permissions and are logged in to the web console.
  • You have installed the Web Terminal Operator.

Procedure

  1. In the Administrator perspective, navigate to Administation Cluster Settings.
  2. On the Cluster Settings page, click the Configuration tab.
  3. On the Configuration page, click the Console configuration resource with the description operator.openshift.io.

    Image of the Configuration page showing the correct Console configuration resource to select
  4. From the Action drop-down list, select Customize, which opens the Cluster configuration page.
  5. Click the Web Terminal tab, which opens the Web Terminal Configuration page.
  6. Enter the URL of the image that you want to use.
  7. Click Save.

8.3. Using the web terminal

You can launch an embedded command line terminal instance in the web console. This terminal instance is preinstalled with common CLI tools for interacting with the cluster, such as oc, kubectl,odo, kn, tkn, helm, and subctl. It also has the context of the project you are working on and automatically logs you in using your credentials.

8.3.1. Accessing the web terminal

After the Web Terminal Operator is installed, you can access the web terminal. After the web terminal is initialized, you can use the preinstalled CLI tools like oc, kubectl, odo, kn, tkn, helm, and subctl in the web terminal. You can re-run commands by selecting them from the list of commands you have run in the terminal. These commands persist across multiple terminal sessions. The web terminal remains open until you close it or until you close the browser window or tab.

Prerequisites

  • You have access to an OpenShift Container Platform cluster and are logged into the web console.
  • The Web Terminal Operator is installed on your cluster.

Procedure

  1. To launch the web terminal, click the command line terminal icon ( odc wto icon ) in the masthead of the console. A web terminal instance is displayed in the Command line terminal pane. This instance is automatically logged in with your credentials.
  2. If a project has not been selected in the current session, select the project where the DevWorkspace CR must be created from the Project drop-down list. By default, the current project is selected.

    Note
    • One DevWorkspace CR defines the web terminal of one user. This CR contains details about the user’s web terminal status and container image components.
    • The DevWorkspace CR is created only if it does not already exist.
    • The openshift-terminal project is the default project used for cluster administrators. They do not have the option to choose another project. The Web Terminal Operator installs the DevWorkspace Operator as a dependency.
  3. Optional: Set the web terminal timeout for the current session:

    1. Click Timeout.
    2. In the field that appears, enter the timeout value.
    3. From the drop-down list, select a timeout interval of Seconds, Minutes, Hours, or Milliseconds.
  4. Optional: Select a custom image for the web terminal to use.

    1. Click Image.
    2. In the field that appears, enter the URL of the image that you want to use.
  5. Click Start to initialize the web terminal using the selected project.
  6. Click + to open multiple tabs within the web terminal in the console.

8.4. Troubleshooting the web terminal

8.4.1. Web terminal and network policies

The web terminal might fail to start if the cluster has network policies configured. To start a web terminal instance, the Web Terminal Operator must communicate with the web terminal’s pod to verify it is running, and the OpenShift Container Platform web console needs to send information to automatically log in to the cluster within the terminal. If either step fails, the web terminal fails to start and the terminal panel is in a loading state until a context deadline exceeded error occurs.

To avoid this issue, ensure that the network policies for namespaces that are used for terminals allow ingress from the openshift-console and openshift-operators namespaces.

The following samples show NetworkPolicy objects for allowing ingress from the openshift-console and openshift-operators namespaces.

Allowing ingress from the openshift-console namespace

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-from-openshift-console
spec:
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: openshift-console
  podSelector: {}
  policyTypes:
  - Ingress

Allowing ingress from the openshift-operators namespace

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-from-openshift-operators
spec:
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: openshift-operators
  podSelector: {}
  policyTypes:
  - Ingress

8.5. Uninstalling the web terminal

Uninstalling the Web Terminal Operator does not remove any of the custom resource definitions (CRDs) or managed resources that are created when the Operator is installed. For security purposes, you must manually uninstall these components. By removing these components, you save cluster resources because terminals do not idle when the Operator is uninstalled.

Uninstalling the web terminal is a two-step process:

  1. Uninstall the Web Terminal Operator and related custom resources (CRs) that were added when you installed the Operator.
  2. Uninstall the DevWorkspace Operator and its related custom resources that were added as a dependency of the Web Terminal Operator.

8.5.1. Removing the Web Terminal Operator

You can uninstall the web terminal by removing the Web Terminal Operator and custom resources used by the Operator.

Prerequisites

  • You have access to an OpenShift Container Platform cluster with cluster administrator permissions.
  • You have installed the oc CLI.

Procedure

  1. In the Administrator perspective of the web console, navigate to Operators Installed Operators.
  2. Scroll the filter list or type a keyword into the Filter by name box to find the Web Terminal Operator.
  3. Click the Options menu kebab for the Web Terminal Operator, and then select Uninstall Operator.
  4. In the Uninstall Operator confirmation dialog box, click Uninstall to remove the Operator, Operator deployments, and pods from the cluster. The Operator stops running and no longer receives updates.

8.5.2. Removing the DevWorkspace Operator

To completely uninstall the web terminal, you must also remove the DevWorkspace Operator and custom resources used by the Operator.

Important

The DevWorkspace Operator is a standalone Operator and may be required as a dependency for other Operators installed in the cluster. Follow the steps below only if you are sure that the DevWorkspace Operator is no longer needed.

Prerequisites

  • You have access to an OpenShift Container Platform cluster with cluster administrator permissions.
  • You have installed the oc CLI.

Procedure

  1. Remove the DevWorkspace custom resources used by the Operator, along with any related Kubernetes objects:

    $ oc delete devworkspaces.workspace.devfile.io --all-namespaces --all --wait
    $ oc delete devworkspaceroutings.controller.devfile.io --all-namespaces --all --wait
    Warning

    If this step is not complete, finalizers make it difficult to fully uninstall the Operator.

  2. Remove the CRDs used by the Operator:

    Warning

    The DevWorkspace Operator provides custom resource definitions (CRDs) that use conversion webhooks. Failing to remove these CRDs can cause issues in the cluster.

    $ oc delete customresourcedefinitions.apiextensions.k8s.io devworkspaceroutings.controller.devfile.io
    $ oc delete customresourcedefinitions.apiextensions.k8s.io devworkspaces.workspace.devfile.io
    $ oc delete customresourcedefinitions.apiextensions.k8s.io devworkspacetemplates.workspace.devfile.io
    $ oc delete customresourcedefinitions.apiextensions.k8s.io devworkspaceoperatorconfigs.controller.devfile.io
  3. Verify that all involved custom resource definitions are removed. The following command should not display any output:

    $ oc get customresourcedefinitions.apiextensions.k8s.io | grep "devfile.io"
  4. Remove the devworkspace-webhook-server deployment, mutating, and validating webhooks:

    $ oc delete deployment/devworkspace-webhook-server -n openshift-operators
    $ oc delete mutatingwebhookconfigurations controller.devfile.io
    $ oc delete validatingwebhookconfigurations controller.devfile.io
    Note

    If you remove the devworkspace-webhook-server deployment without removing the mutating and validating webhooks, you can not use oc exec commands to run commands in a container in the cluster. After you remove the webhooks you can use the oc exec commands again.

  5. Remove any remaining services, secrets, and config maps. Depending on the installation, some resources included in the following commands may not exist in the cluster.

    $ oc delete all --selector app.kubernetes.io/part-of=devworkspace-operator,app.kubernetes.io/name=devworkspace-webhook-server -n openshift-operators
    $ oc delete serviceaccounts devworkspace-webhook-server -n openshift-operators
    $ oc delete clusterrole devworkspace-webhook-server
    $ oc delete clusterrolebinding devworkspace-webhook-server
  6. Uninstall the DevWorkspace Operator:

    1. In the Administrator perspective of the web console, navigate to Operators Installed Operators.
    2. Scroll the filter list or type a keyword into the Filter by name box to find the DevWorkspace Operator.
    3. Click the Options menu kebab for the Operator, and then select Uninstall Operator.
    4. In the Uninstall Operator confirmation dialog box, click Uninstall to remove the Operator, Operator deployments, and pods from the cluster. The Operator stops running and no longer receives updates.
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.