Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Devfiles and Kubernetes cluster support in OpenShift Connector 0.2.0 extension for VS Code

 

November 16, 2020
Mohit Suman
Related topics:
ContainersIDEsKubernetes
Related products:
Red Hat OpenShift

Share:

    We are pleased to announce that the new release of the OpenShift Connector extension for Visual Studio Code (VS Code) is now available. The 0.2.0 release offers new features for rapidly developing and deploying code on Kubernetes and Red Hat OpenShift clusters. OpenShift Connector now supports component deployment using devfiles, leveraging odo 2.0 command-line interface under the hood.

    With this release, the extension now supports connecting to vanilla Kubernetes clusters and includes a new option for creating OpenShift 4 clusters locally via Red Hat CodeReady Containers (CRC). In this article, we introduce these new features and present the workflow for using CodeReady Containers with OpenShift Connector 0.2.0.

    Install OpenShift Connector 0.2.0

    1. Install the OpenShift Connector plug-in directly from the Visual Studio Code Marketplace.
    2. Alternatively, select the Extensions view in VS Code by clicking on its square icon in the left-side taskbar. Search for the OpenShift Connector plug-in and click Install.
    3. Once you have installed the extension, the OpenShift icon will be added to the left-side activity bar and ready for use.

    Odo 2.0 in OpenShift Connector 0.2.0

    OpenShift Connector now supports odo 2.0 in addition to Source-to-Image (S2I) files. Using odo, you can create devfile-based components and deploy them on your OpenShift and Kubernetes clusters.

    Using devfiles in VS Code

    A devfile is a YAML file used to define the developer workspace in Eclipse Che. Now supported in odo 2.0, devfiles are easily configured and reproducible definitions for portable developer environments. Each devfile is a declarative abstraction of a developer workspace. It includes the runtime environment and project source code, mapped to the repositories, tools, plugins, and commands that you need to code, build, test, run, and debug your applications. Using devfiles makes your developer workspace replicable. You can use OpenShift application definitions within a devfile.

    List devfile components

    OpenShift Connector now lets you view a list of currently supported devfile components in your integrated VS Code terminal window. Right-click on your OpenShift or Kubernetes cluster and select List Catalog Components. You will see the following output in the terminal (see Figure 1).

    The terminal displays a list of current devfile components.
    odo catalog
    Figure 1: Select 'List Catalog Components' to see a list of currently supported devfile components.

    List Operator-based services

    You can also use OpenShift Connector (and odo 2.0 under the hood) to view a list of Operator-based services in your VS Code terminal window. Right-click on your OpenShift or Kubernetes cluster and select List Catalog Services. You will see the following list in the terminal (see Figure 2).

    The terminal displays a list of Operator-based services in the cluster.
    Figure 2: Select 'List Catalog Services' to see a list of Operators in the cluster.

    Note: OpenShift Connector's support for odo 2.0 aligns with the move to using devfiles as the common definition format across Red Hat's developer tooling portfolio.

    Working demo of a devfile integration

    This demonstration video guides you through the workflow to use a Node.js devfile deployment configuration on a remote OpenShift cluster.

    Run OpenShift clusters locally

    OpenShift Connector now lets you create OpenShift 4 clusters directly from the extension in VS Code. We have added this feature to improve the inner loop development experience for developers on OpenShift. Several infrastructure options are available, including using CodeReady Containers to run an OpenShift 4 cluster locally.

    To access this feature, select the new Add OpenShift Cluster (+ icon) command in VS Code's Application Explorer view, as shown in Figure 3.

    The 'Add OpenShift Cluster' option is a link in the upper-right corner of the screen.
    Figure 3: Select the 'Add OpenShift Cluster' option in VS Code's Application Explorer view.

    You will then see the two options displayed in Figure 4.

    Deploy your cluster locally or in a public cloud
    Figure 4: Deploy your cluster locally or in a public cloud.

    Create a cluster locally

    OpenShift Connector leverages CodeReady Containers to let you create a minimal, preconfigured OpenShift 4 cluster on your laptop or desktop for development and testing. The OpenShift Connector 0.2.0 extension supports CodeReady Containers 1.16.0, which currently runs OpenShift 4.5.9. (We are releasing support for OpenShift 4.6 soon.)

    Selecting the Create/Refresh Cluster option opens a wizard view where you can configure the cluster memory, CPU cores, nameserver, and more. Once you've completed the configuration, you will be able to start, stop, and refresh the cluster as needed. You can then view the cluster's status as it runs in your local system. This feature is supported for all three platforms, including Windows, Linux, and macOS.

    Note: The CodeReady Containers OpenShift cluster is ephemeral and is not intended for production use. See the CodeReady Containers Getting Started Guide for more details.

    Deploy a cluster in a public cloud

    If you prefer to deploy your cluster in a public cloud, you may install OpenShift 4 in your account with a supported public cloud provider. Public cloud options include Amazon Web Services (AWS), Microsoft Azure, and Google Cloud.

    How to run CodeReady Containers using OpenShift Connector 0.2.0

    You can quickly set up and run CodeReady Containers using OpenShift Connector 0.2.0.

    1. Download the CodeReady Containers bundle: Download and extract the CodeReady Containers 1.16.0 bundle for your operating system and place the binary in your $PATH. Be sure to provide the full executable location when you provide the path (for example, ~/Downloads/crc-macos-1.16.0-amd64/crc). Figure 5 shows the options to download the 1.16.0 bundle and set the binary location.
    Download the CodeReady Containers binary and add the binary location
    Figure 5: Download the CodeReady Containers binary and add the binary location.
    1. Set the file path for the image pull secret: The next step is to provide the pull secret's file location, as shown in Figure 6. You can download and upload a pull secret file using your Red Hat developer account.
    Select pull secret file location
    Figure 6: Provide the pull secret's file location.
    1. Select the following optional CRC configurations:
      • CPU cores: Number of CPU cores to allocate to the OpenShift cluster (the default is four).
      • Memory: MiB value of memory to allocate to the OpenShift cluster (the default is 9,216).
      • Nameserver: IPv4 address of the nameserver to use for the OpenShift cluster.

      Figure 7 shows the optional configurations.

    Enter the optional configurations for CodeReady Containers
    Figure 7: Enter the optional configurations for CodeReady Containers.
    1. Set up CodeReady Containers: Click Setup CRC, and the command will be executed in the VS Code integrated terminal, as shown in Figure 8. This action sets up your host machine's environment for the CodeReady Containers virtual machine. The ~/.crc directory will be created if it does not already exist.
    Set up your host operating system for the CodeReady Containers virtual machine
    Figure 8: Set up your host operating system for the CodeReady Containers virtual machine.
    1. Start the cluster: This command, shown in Figure 9, starts the CodeReady Containers virtual machine and creates a minimal OpenShift 4.5.9 cluster on your laptop or desktop computer.
    Start CodeReady Containers
    Figure 9: Start CodeReady Containers.

    Once the cluster is running, the OpenShift cluster status will be displayed, as shown in Figure 10.

    The terminal shows that the OpenShift cluster is running.
    Figure 10: Confirm that the OpenShift cluster is running in CodeReady Containers.

    Viewing and managing Kubernetes clusters

    The OpenShift Connector extension depends on Microsoft's Kubernetes extension, which is installed automatically with OpenShift Connector. This extension lets you view all Kubernetes clusters and simplifies the management of Kubernetes resources. Figure 11 shows the Kubernetes extensions as one of OpenShift Connector's dependencies.

    Dependencies for OpenShift Connector
    Figure 11: Dependencies for OpenShift Connector.

    Using the Kubernetes extension's public API, the Kubernetes Clusters view shows OpenShift-specific resources like projects, routes, deployment configurations, image streams, templates, and more. These resources are visible only for OpenShift clusters. The OpenShift Connector extension also provides a Use Project command for switching between multiple OpenShift Projects in the Kubernetes Clusters view.

    Support for OpenShift Connector 0.2.0

    Please reach out if you need support fixing bugs or using new features in OpenShift Connector 0.2.0. We would also be glad to hear from you if you want to propose a new feature for this VS Code extension. You can connect with the OpenShift Connector 0.2.0 development team by:

    • Selecting OpenShift: Report Extension Issue from your VS Code command palette or the extension title view.
    • Submitting an issue directly on the VS Code OpenShift Tools GitHub repository.
    • Discussing your issue with the development team and community on Gitter.

    Try OpenShift Connector 0.2.0

    The OpenShift Connector 0.2.0 extension is available for installation from the VS Code Marketplace and the open-vsix.org registry. We are already working on new features for future releases. Stay tuned for updates!

    Last updated: February 5, 2024

    Recent Posts

    • Integrate Red Hat AI Inference Server & LangChain in agentic workflows

    • Streamline multi-cloud operations with Ansible and ServiceNow

    • Automate dynamic application security testing with RapiDAST

    • Assessing AI for OpenShift operations: Advanced configurations

    • OpenShift Lightspeed: Assessing AI for OpenShift operations

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue