このコンテンツは選択した言語では利用できません。
Chapter 4. Install Red Hat OpenShift Dev Spaces
Install Red Hat OpenShift Dev Spaces on an OpenShift cluster by using the command-line interface (CLI) or the web console.
You can deploy only one instance of OpenShift Dev Spaces per cluster.
4.1. Install Dev Spaces on OpenShift using CLI リンクのコピーリンクがクリップボードにコピーされました!
Install OpenShift Dev Spaces on OpenShift by using the dsc CLI management tool to deploy a new instance.
Prerequisites
- You have an OpenShift Container Platform 4.22 or later cluster.
-
You have an active
ocsession with administrative permissions to the OpenShift cluster. See Getting started with the OpenShift CLI. -
You have the
dscmanagement tool installed. See Section 2.2, “Install the dsc management tool”.
Procedure
Optional: If you previously deployed OpenShift Dev Spaces on this OpenShift cluster, ensure that the previous OpenShift Dev Spaces instance is removed:
$ dsc server:deleteCreate the OpenShift Dev Spaces instance:
$ dsc server:deploy --platform openshift
Verification
Verify the OpenShift Dev Spaces instance status:
$ dsc server:statusNavigate to the OpenShift Dev Spaces cluster instance:
$ dsc dashboard:open
4.2. Install Dev Spaces on OpenShift using the web console リンクのコピーリンクがクリップボードにコピーされました!
Install OpenShift Dev Spaces on OpenShift through the web console by deploying the Operator from OperatorHub and creating a CheCluster instance.
Prerequisites
- You have an OpenShift web console session as a cluster administrator. See Accessing the web console.
-
You have an active
ocsession with administrative permissions to the OpenShift cluster. See Getting started with the OpenShift CLI. - For a repeat installation: you have uninstalled the previous OpenShift Dev Spaces instance according to Chapter 24, Uninstall OpenShift Dev Spaces.
Procedure
-
In the Administrator view of the OpenShift web console, go to Operators
OperatorHub and search for Red Hat OpenShift Dev Spaces. Install the Red Hat OpenShift Dev Spaces Operator.
TipImportantThe Red Hat OpenShift Dev Spaces Operator depends on the Dev Workspace Operator. If you install the Red Hat OpenShift Dev Spaces Operator manually to a non-default namespace, ensure that the Dev Workspace Operator is also installed in the same namespace. The Operator Lifecycle Manager installs the Dev Workspace Operator as a dependency within the Red Hat OpenShift Dev Spaces Operator namespace. If the Dev Workspace Operator is already installed in a different namespace, two conflicting installations can result.
ImportantIf you want to onboard Web Terminal Operator on the cluster, use the same installation namespace as the Red Hat OpenShift Dev Spaces Operator. Both operators depend on the Dev Workspace Operator, so all three must be installed in the same namespace.
Create the
openshift-devspacesproject in OpenShift as follows:oc create namespace openshift-devspaces-
Go to Operators
Installed Operators Red Hat OpenShift Dev Spaces instance Specification Create CheCluster YAML view. -
In the YAML view, replace
namespace: openshift-operatorswithnamespace: openshift-devspaces. Select Create.
Tip
Verification
- In Red Hat OpenShift Dev Spaces instance Specification, go to devspaces, landing on the Details tab.
- Under Message, check that there is None, which means no errors.
- Under Red Hat OpenShift Dev Spaces URL, wait until the URL of the OpenShift Dev Spaces instance appears, and then open the URL to check the OpenShift Dev Spaces dashboard.
- In the Resources tab, view the resources for the OpenShift Dev Spaces deployment and their status.
4.3. Install OpenShift Dev Spaces in a restricted environment on OpenShift リンクのコピーリンクがクリップボードにコピーされました!
Install OpenShift Dev Spaces on an air-gapped OpenShift cluster by mirroring required images and operator catalogs to a registry within the restricted network.
On a restricted network, deploying OpenShift Dev Spaces and running workspaces requires the following public resources:
- Operator catalog
- Container images
- Sample projects
To make these resources available, you can replace them with their copy in a registry accessible by the OpenShift cluster.
Prerequisites
- You have an OpenShift cluster with at least 64 GB of disk space.
- You have an OpenShift cluster ready to operate on a restricted network. See About disconnected installation mirroring and Using Operator Lifecycle Manager on restricted networks.
-
You have an active
ocsession with administrative permissions to the OpenShift cluster. See Getting started with the OpenShift CLI. -
You have an active
oc registrysession to theregistry.redhat.ioRed Hat Ecosystem Catalog. See Red Hat Container Registry authentication. -
You have
opminstalled. See Installing theopmCLI. -
You have
jqinstalled. See Downloadingjq. -
You have
podmaninstalled. See Podman Installation Instructions. -
You have
skopeoversion 1.6 or higher installed. See Installing Skopeo. -
You have an active
skopeosession with administrative access to the private Docker registry. See Authenticating to a registry and Mirroring images for a disconnected installation. -
You have
dscfor OpenShift Dev Spaces version 3.27 installed. See Section 2.2, “Install the dsc management tool”.
Procedure
Download and execute the mirroring script to install a custom Operator catalog and mirror the related images.
$ bash prepare-restricted-environment.sh \ --devworkspace_operator_index registry.redhat.io/redhat/redhat-operator-index:v4.22\ --devworkspace_operator_version "v0.40.0" \ --prod_operator_index "registry.redhat.io/redhat/redhat-operator-index:v4.22" \ --prod_operator_package_name "devspaces" \ --prod_operator_bundle_name "devspacesoperator" \ --prod_operator_version "v3.27.0" \ --my_registry "<my_registry>"--my_registry- The private Docker registry where the images will be mirrored
Procedure
Install OpenShift Dev Spaces with the configuration set in the
che-operator-cr-patch.yamlduring the previous step:$ dsc server:deploy \ --platform=openshift \ --olm-channel stable \ --catalog-source-name=devspaces-disconnected-install \ --catalog-source-namespace=openshift-marketplace \ --skip-devworkspace-operator \ --che-operator-cr-patch-yaml=che-operator-cr-patch.yaml- Allow incoming traffic from the OpenShift Dev Spaces namespace to all Pods in the user projects. See: Section 12.1, “Configure network policies”.
Verification
Verify that the OpenShift Dev Spaces instance is running:
$ dsc server:status
4.4. Set up an Ansible sample リンクのコピーリンクがクリップボードにコピーされました!
Configure an Ansible sample for use in restricted OpenShift Dev Spaces environments.
Prerequisites
- You have Microsoft Visual Studio Code - Open Source IDE as the configured editor.
- You have a 64-bit x86 system.
Procedure
Mirror the following images:
ghcr.io/ansible/ansible-devspaces@sha256:ce1ecc3b3c350eab2a9a417ce14a33f4b222a6aafd663b5cf997ccc8c601fe2c registry.access.redhat.com/ubi8/python-39@sha256:301fec66443f80c3cc507ccaf72319052db5a1dc56deb55c8f169011d4bbaacbConfigure the cluster proxy to allow access to the following domains:
.ansible.com .ansible-galaxy-ng.s3.dualstack.us-east-1.amazonaws.comNoteSupport for the following IDE and CPU architectures is planned for a future release:
CPU architectures
- IBM Power (ppc64le)
- IBM Z (s390x)
4.5. Install OpenShift Dev Spaces on OpenShift with Keycloak as external identity provider リンクのコピーリンクがクリップボードにコピーされました!
Install OpenShift Dev Spaces on an OpenShift cluster that uses Keycloak as an external OpenID Connect (OIDC) identity provider for centralized user authentication.
Prerequisites
-
You have an active
ocsession with administrative permissions to the OpenShift cluster. See Getting started with the CLI. - You have Keycloak configured as an external identity provider for OpenShift. See Enabling direct authentication with an external OIDC identity provider.
Procedure
Define the environment variables:
# The Keycloak realm used for OpenShift authentication: OPENSHIFT_REALM=<realm> # The Keycloak URL: KEYCLOAK_URL=<keycloak_url>Create a
devspacesclient in the Keycloak Admin Console:- Within the realm used for OpenShift authentication, select Clients on the left side of the navigation bar.
- Select the Create client button.
On the General Settings page:
-
Enter
devspacesin the Client ID field. - Optional: Enter a Name and Description for the OAuth client.
- Click Next.
-
Enter
On the Capability config page:
- Toggle Client authentication to On.
- Click Next.
- Click Save.
- Navigate to the Credentials tab of the newly created client and copy the Client secret value for use when applying the OAuth client secret.
Add the
devspacesclient to the audiences list in the OpenShift authentication configuration:oc patch authentication.config/cluster \ --type='json' \ -p='[ { "op": "add", "path": "/spec/oidcProviders/0/issuer/audiences/-", "value": "devspaces" } ]'NoteIf you have multiple OIDC providers configured, adjust the array index in the path (currently 0) to match your Keycloak provider’s position in the configuration.
Wait for the
kube-apiservercluster Operator to roll out the configuration changes:watch oc get co kube-apiserverCreate a project for OpenShift Dev Spaces:
oc create project openshift-devspacesCreate a secret for the OAuth client in the OpenShift Dev Spaces namespace:
oc apply -f - <<EOF apiVersion: v1 kind: Secret metadata: name: oauth-secret namespace: openshift-devspaces labels: app.kubernetes.io/part-of: che.eclipse.org stringData: oAuthSecret: <client_secret> EOFwhere:
<client_secret>-
The client secret value from the
devspacesclient in Keycloak.
Optional: Create the
ConfigMapwith a Keycloak certificate in theopenshift-devspacesnamespace. If Keycloak uses a certificate that is already trusted by OpenShift, skip this step.openssl s_client \ -connect "$(echo "$KEYCLOAK_URL" | sed 's|https://||'):443" \ -showcerts < /dev/null \ | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' \ > keycloak-ca.crt oc create configmap keycloak-certs \ --from-file=keycloak-ca.crt=keycloak-ca.crt \ -n openshift-devspaces && \ oc label configmap keycloak-certs \ app.kubernetes.io/part-of=che.eclipse.org \ app.kubernetes.io/component=ca-bundle \ -n openshift-devspacesPrepare the
CheClusterpatch:cat > che-patch.yaml << EOF kind: CheCluster apiVersion: org.eclipse.che/v2 spec: networking: auth: oAuthClientName: devspaces oAuthSecret: oauth-secret identityProviderURL: "$KEYCLOAK_URL/realms/$OPENSHIFT_REALM" gateway: oAuthProxy: cookieExpireSeconds: 300 deployment: containers: - name: oauth-proxy env: - name: OAUTH2_PROXY_CODE_CHALLENGE_METHOD value: S256 - name: OAUTH2_PROXY_BACKEND_LOGOUT_URL value: "$KEYCLOAK_URL/realms/$OPENSHIFT_REALM/protocol/openid-connect/logout?id_token_hint={id_token}" components: cheServer: extraProperties: CHE_OIDC_GROUPS__CLAIM: '<GROUPS_CLAIM>' CHE_OIDC_GROUPS__PREFIX: '<GROUPS_PREFIX>' CHE_OIDC_USERNAME__CLAIM: '<USERNAME_CLAIM>' CHE_OIDC_USERNAME__PREFIX: '<USERNAME_PREFIX>' EOFwhere:
CHE_OIDC_GROUPS__CLAIM- The claim to use for extracting user groups.
CHE_OIDC_GROUPS__PREFIX- The prefix to add to group names. Empty string means no prefix.
CHE_OIDC_USERNAME__CLAIM- The claim to use for extracting the username.
CHE_OIDC_USERNAME__PREFIXThe prefix to add to usernames. Empty string means no prefix.
NoteThese values must match the corresponding claim and prefix settings configured in the
authentication.config/clusterresource. To view the current cluster configuration, run:oc get authentication.config/cluster -o yaml
Create the OpenShift Dev Spaces instance with
dsc:dsc server:deploy \ --platform openshift \ --che-operator-cr-patch-yaml che-patch.yamlUpdate the
devspacesclient to set the OpenShift Dev Spaces redirect URI and web origin.Obtain the Red Hat OpenShift Dev Spaces URL:
echo "$(oc get checluster devspaces -n openshift-devspaces -o jsonpath='{.status.cheURL}')"-
In the Valid redirect URIs field, enter the URL above with
/oauth/callbackappended. - In the Web origins field, enter the URL above.
- Click Save.
-
In the Valid redirect URIs field, enter the URL above with
Verification
Verify the OpenShift Dev Spaces instance status:
dsc server:statusNavigate to the OpenShift Dev Spaces cluster instance:
dsc dashboard:open- Log in to the OpenShift Dev Spaces instance.
4.6. Find the fully qualified domain name (FQDN) リンクのコピーリンクがクリップボードにコピーされました!
Retrieve the fully qualified domain name (FQDN) of your organization’s instance of OpenShift Dev Spaces on the command line to access the OpenShift Dev Spaces dashboard URL.
You can find the FQDN for your organization’s OpenShift Dev Spaces instance in the Administrator view of the OpenShift web console as follows. Go to Operators
Prerequisites
-
You have an active
ocsession with administrative permissions to the OpenShift cluster. See Getting started with the OpenShift CLI.
Procedure
Run the following command:
oc get checluster devspaces -n openshift-devspaces -o jsonpath='{.status.cheURL}'
Verification
- Open the returned URL in a web browser and verify that the OpenShift Dev Spaces dashboard loads.
4.7. Permissions to install OpenShift Dev Spaces on OpenShift using CLI リンクのコピーリンクがクリップボードにコピーされました!
A specific set of permissions is required to install OpenShift Dev Spaces on an OpenShift cluster using the dsc CLI tool.
The following YAML shows the minimal set of permissions required to install OpenShift Dev Spaces on an OpenShift cluster using dsc:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: devspaces-install-dsc
rules:
- apiGroups: ["org.eclipse.che"]
resources: ["checlusters"]
verbs: ["*"]
- apiGroups: ["project.openshift.io"]
resources: ["projects"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list", "create"]
- apiGroups: [""]
resources: ["pods", "configmaps"]
verbs: ["get", "list"]
- apiGroups: ["route.openshift.io"]
resources: ["routes"]
verbs: ["get", "list"]
# OLM resources permissions
- apiGroups: ["operators.coreos.com"]
resources: ["catalogsources", "subscriptions"]
verbs: ["create", "get", "list", "watch"]
- apiGroups: ["operators.coreos.com"]
resources: ["operatorgroups", "clusterserviceversions"]
verbs: ["get", "list", "watch"]
- apiGroups: ["operators.coreos.com"]
resources: ["installplans"]
verbs: ["patch", "get", "list", "watch"]
- apiGroups: ["packages.operators.coreos.com"]
resources: ["packagemanifests"]
verbs: ["get", "list"]
4.8. Permissions to install OpenShift Dev Spaces on OpenShift using web console リンクのコピーリンクがクリップボードにコピーされました!
A specific set of permissions is required to install OpenShift Dev Spaces on an OpenShift cluster using the web console.
The following YAML shows the minimal set of permissions required to install OpenShift Dev Spaces on an OpenShift cluster using the web console:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: devspaces-install-web-console
rules:
- apiGroups: ["org.eclipse.che"]
resources: ["checlusters"]
verbs: ["*"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list", "create"]
- apiGroups: ["project.openshift.io"]
resources: ["projects"]
verbs: ["get", "list", "create"]
# OLM resources permissions
- apiGroups: ["operators.coreos.com"]
resources: ["subscriptions"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["operators.coreos.com"]
resources: ["operatorgroups"]
verbs: ["get", "list", "watch"]
- apiGroups: ["operators.coreos.com"]
resources: ["clusterserviceversions", "catalogsources", "installplans"]
verbs: ["get", "list", "watch", "delete"]
- apiGroups: ["packages.operators.coreos.com"]
resources: ["packagemanifests", "packagemanifests/icon"]
verbs: ["get", "list", "watch"]
# Workaround related to viewing operators in OperatorHub
- apiGroups: ["operator.openshift.io"]
resources: ["cloudcredentials"]
verbs: ["get", "list", "watch"]
- apiGroups: ["config.openshift.io"]
resources: ["infrastructures", "authentications"]
verbs: ["get", "list", "watch"]