Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 2. Developing for the Cloud with OpenShift


Using the OpenShift Container Platform tooling you can create, import, and modify OpenShift Container Platform applications.

2.1.1. Creating a new OpenShift Container Platform connection

You must create an OpenShift connection in the OpenShift Explorer view in CodeReady Studio to use the OpenShift tooling in the IDE. An OpenShift connection connects your IDE to an OpenShift instance (based on CDK, OpenShift Online, Kubernetes, minishift). The connection is listed in the OpenShift Explorer view. You can have more than one OpenShift connection configured in the IDE.

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Right-click any area in the OpenShift Explorer.

  7. Click New Connection.

    The Sign in to OpenShift window appears.

  8. Paste the URL for the OpenShift server into the Server field.
  9. Authenticate with token or login credentials.

    Note

    Alternatively, you can copy the Login Command from the OpenShift Container Platform web UI.

    To get login credentials, click the drop-down menu in the top right corner Copy Login Command

  10. Click Finish.

Your newly added connection is now listed in the OpenShift Explorer view.

2.1.2. Creating a new OpenShift Container Platform project

You must create a project, which essentially is a namespace with additional annotations, to centrally manage the access to resources for regular users.

Prerequisites

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Right-click the OpenShift Container Platform connection New Project.

    The New OpenShift Project window appears.

  7. Name your project.
  8. Click Finish.

Your newly created OpenShift project is now listed in the OpenShift Explorer view.

2.1.3. Creating a new OpenShift Container Platform application

You can use the OpenShift Application wizard in the IDE to create OpenShift Container Platform applications from default or custom templates.

Prerequisites

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Right-click the OpenShift Container Platform connection New Application.

    The Select template window appears.

  7. Select the template.
  8. Click Next.

    The Template Parameters window appears.

  9. Click Next.

    The Resource Labels window appears.

  10. Click Add to add labels.
  11. Click Finish.

    The Create Application Summary window appears.

  12. Click OK.

    The Import OpenShift application window appears.

  13. Select the Git Clone Location.
  14. Click Finish.

Your newly created OpenShift Container Platform application is now listed in the OpenShift Explorer view.

Additional Resources

  • For more information about using and creating templates with OpenShift Container Platform, see Using templates.

The OpenShift Explorer view in the IDE lists applications associated with your OpenShift Container Platform accounts. You can import the source code for these applications individually into the IDE using the Import OpenShift Application wizard. After the application is imported, you can easily modify the application source code, build the application, and view it in a web browser.

Prerequisites

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Right-click your OpenShift Container Platform connection Import OpenShift Application.

    The Select Build Config window appears.

  7. Select the application to import.
  8. Click Next.

    The Import OpenShift application window appears.

  9. Select the Git Clone Location.
  10. Click Finish.

Your newly imported OpenShift Container Platform application is now listed in the OpenShift Explorer view.

2.1.5. Deploying an application using the server adapter

The server adapter enables you to publish the changes that you made in your workspace project to the running OpenShift application on the OpenShift instance. It enables incremental deployment of applications directly into the deployed pods on OpenShift. You can use the server adapter to push changes in your application directly to the running OpenShift application without committing the source code to the Git repository.

Prerequisites

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Expand the OpenShift Container Platform connection.
  7. Right-click your application Server Adapter.

    The Server Settings window appears.

  8. Click Finish.

The Servers view appears, starting your server adapter.

To open your application in a browser, right-click application Show In Web Browser.

The CodeReady Studio built-in web browser opens, displaying your application.

2.1.6. Deleting an OpenShift Container Platform project

You may choose to delete a project from the workspace to make a fresh start in project development or after you have concluded development in a project. When you delete a project, all the resources associated with the project are deleted.

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Expand the OpenShift Container Platform connection.
  7. Right-click your project Delete.

    The Delete OpenShift Resource window appears.

  8. Click OK.

Your project is now deleted.

The IDE allows users to set up a connection to a remote instance of OpenShift Container Platform and then use logs (application logs and build logs) to troubleshoot and monitor running applications.

2.2.1. Setting up OpenShift Client Binaries

Prerequisites

Before setting up port forwarding or streaming application and build logs, it is mandatory to set up OpenShift Client Binaries.

Procedure

  1. Start CodeReady Studio.
  2. Click Window Preferences.

    The Preferences window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift.
  5. Click Browse to locate the oc executable.
  6. Click Apply and Close.

OpenShift Client Binaries are now set up.

2.2.2. Setting up Port Forwarding

Using the Application Port Forwarding window, you can connect the local ports to their remote counterparts to access data or debug the application. Port forwarding automatically stops due to any one of the following reasons:

  • The OpenShift Container Platform connection terminates
  • The IDE shuts down
  • The workspace is changed

Port forwarding must be enabled each time to connect to OpenShift Container Platform from the IDE.

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Expand the OpenShift Container Platform connection.
  7. Right-click the application Port Forwarding.

    The Port Forwarding window appears.

  8. Check the Find free local ports for remote ports box.
  9. Click Start All.
  10. Click OK.

The Console view appears showing the port-forwarding starting process.

2.2.3. Streaming Pod Logs

Pod logs are general logs for an application running on a remote OpenShift Container Platform instance. The streaming application logs feature in the IDE is used to monitor applications and use the previous pod log to troubleshoot if the application fails or returns errors.

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Expand the OpenShift Container Platform connection.
  7. Right-click the application Port Log.

The Console view appears displaying the Pod Log.

2.2.4. Streaming Build Logs

Build logs are logs that document changes to applications running on a remote OpenShift Container Platform instance. The streaming build logs feature in the IDE is used to view the progress of the application build process and to debug the application.

Procedure

  1. Start CodeReady Studio.
  2. Click Window Show View Other.

    The Show View window appears.

  3. Enter OpenShift in the search field.
  4. Select OpenShift Explorer.
  5. Click Open.

    The OpenShift Explorer view appears.

  6. Expand the OpenShift Container Platform connection.
  7. Right-click the application Build Log.

The Console view appears displaying the Build Log.

2.3. Additional resources

Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat