Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

How the odo CLI simplifies Kubernetes development

November 20, 2023
Cedric Clyburn
Related topics:
Kubernetes
Related products:
Red Hat OpenShift

    Within the inner loop phase of application development, we’re working with continuous coding, building, and testing our application until it’s ready for staging or production. However, when we deploy to cloud-native solutions like Kubernetes or Red Hat OpenShift, this gets a bit more tricky. There are complexities in knowing Kubernetes and DevOps concepts and a steep learning curve. But that’s exactly where odo comes in. This is a developer-focused command line interface (CLI) for fast, iterative, and simplified container-based application development. Let’s take a look at how to use odo to locally deploy to Podman and then to a Kubernetes and remote OpenShift cluster.

    What is odo?

    The odo open source CLI tool for rapid cloud-native development facilitates an iterative coding process on Kubernetes and OpenShift and is powered by the open Devfile standard. Specifically, odo can supercharge our path to development within a container in just two commands, odo init and odo dev, which auto-detects our source code and allows live coding. The simple syntax helps to focus on coding, abstracting all the complexities away from Kubernetes and even letting us start without a cluster by running our containerized application locally in the Podman container engine (Figure 1).

    Checking out the odo.dev homepage
    Figure 1. Checking out the odo.dev homepage.

    Getting started with odo

    Let’s take a look at how we can easily install the odo CLI tool, then bootstrap a project using the Kubernetes-ready Quarkus Java framework and begin to see how odo helps us in the inner loop of cloud-native development without hassle.

    Installing the odo CLI tool

    To install odo, head to the website’s installation page to learn about the process for your machine. It’s a simple binary, but being on macOS, I could easily install odo using the Homebrew package manager with brew install odo-dev (Figure 2).

    Installing odo using the Homebrew package manager on macOS.
    Figure 2. Installing odo through the Homebrew package manager on macOS.

    To debug and test remote applications using odo directly from your IDE, the OpenShift Toolkit for VSCode and JetBrains includes the odo binary to interact with your Kubernetes or OpenShift cluster directly, without leaving your development environment (Figure 3).

    Using odo within the OpenShift Toolkit extension.
    Figure 3. Odo being used by the OpenShift Toolkit for VSCode.

    Initializing an application with odo

    While you may already have a project you’d like to use with odo, let’s start with an example project containing some source code using the container-first Java framework, Quarkus. By visiting the Quarkus quickstart page, we can learn how to quickly generate a project that includes a RESTful endpoint (Figure 4). Make sure to select the Generate your application button on the right-hand side to download a.zip file containing the project (which includes GreetingResource.java exposed on /hello and an index.html landing page for our application).

    Downloading Quarkus starter code for testing with odo.
    Figure 4. Downloading an example Quarkus project to be used with odo.

    From here, let’s head into our terminal to initialize our application, using the odo init command. This will auto-detect our source code, and download the appropriate devfile.yaml that contains the definition of our development environment as code, specifying components, commands, and configurations. As shown in Figure 5, we can simply use the default settings for this process.

    $ odo init
    Initializing our application with the odo init command.
    Figure 5. Viewing the Quarkus project and initializing it using odo.

    Developing an application locally with Podman and odo

    With our code and Devfile ready to go, we can now use the odo dev command to facilitate the development of our application. For example, this includes making changes and previewing in-real time, testing Kubernetes support for our application, and debugging our application. First, let’s start off by targeting Podman for local development before moving on to a Kubernetes cluster (Figure 6).

    $ odo dev --platform=podman
    Starting a containerized development session by targeting the Podman engine.
    Figure 6. Starting a containerized development session by targeting the Podman engine.

    Congratulations! You’ve started development on your Quarkus application, and you can now access the running pod locally with Podman, in addition to some other resources, such as the odo web console and the port forwarding of the application (Figure 7).

    A view of a Quarkus application running locally with Podman.
    Figure 7. Viewing the running Quarkus application in our browser.

    Let’s now begin modifying our source code within the IDE to see odo immediately keeping our containerized application up to date. For this, we’ve added a bit of text to our endpoint. Within seconds, the pod has already been re-deployed. Now, we can see these changes live by calling the example endpoint via our terminal (Figure 8).

    A screenshot of iterating on code with odo.
    Figure 8. Making changes to our Quarkus project to see real-time updates.

    We can also check this out visually by using Podman Desktop, a graphical tool to visualize containers and pods. Within the Pods section of the interface, we can see our running Pod, logs, metadata, and more (Figure 9).

    A view of the running pod within Podman Desktop.
    Figure 9. Visualizing Pod logs through Podman Desktop.

    Developing an application for Kubernetes with odo

    Recently, odo has added support for Podman and local development of containers without access to a cluster. Let’s demonstrate using odo for development on Kubernetes. Of course, you can use any compliant Kubernetes cluster with odo, whether it's a hosted cloud provider, a self-managed cluster, or hosted locally with a tool like Minikube. The process is easy if you’re already connected to your Kubernetes cluster. Simply create a new namespace using the following command (Figure 10):

    $ odo create namespace odo-dev
    A screenshot of creating a new namespace for development using odo.
    Figure 10. Creating a new namespace for our odo development on Kubernetes.

    Now, with our devfile.yaml already in the project, we can continue our inner loop development just as we did with Podman, but now in our Kubernetes cluster. Use the odo dev command to start development, and watch the magic happen as odo takes care of all of the resource creation and watches for live coding changes (Figure 11).

    $ odo dev
    Developing on Kubernetes with odo.
    Figure 11. Starting to iterate on our application with odo dev command.

    Developing an application for OpenShift with odo

    You don’t have a Kubernetes cluster already? No worries. For this next example, we’ll be using the freely available Developer Sandbox for Red Hat OpenShift, which provides immediate access to an OpenShift cluster built on Kubernetes right in your browser.

    First, select Start your sandbox for free to log in with your Red Hat account and get free 30-day access to the Developer Sandbox (Figure 12).

    Viewing the homepage of Developer Sandbox for Red Hat OpenShift.
    Figure 12. Visiting the Developer Sandbox for Red Hat OpenShift homepage.

    To connect odo to this OpenShift cluster, select the Copy login command button from the top-right of the OpenShift Web Console, where you can display your login token and copy it to the clipboard (Figure 13).

    Copying the login token from the Developer Sandbox.
    Figure 13. Copying the login command from the Developer Sandbox for odo authentication.

    Here’s the trick, if you don’t already have the OpenShift `oc` CLI. Replace odo in the command with oc, and you’ll be ready to enter the login token and successfully connect to your cluster (Figure 14). You’ll automatically be defaulted to your single project/namespace in the Developer Sandbox, so we can continue on without making a new project.

    $ odo login <token>
    Authenticating to our OpenShift cluster using odo.
    Figure 14. Authenticating to the OpenShift cluster using the odo login command.

    Finally, let’s kick off the inner loop activities in this cloud-native Kubernetes environment with the odo dev command, which will deploy our Quarkus application to OpenShift similar to how we just did with the Kubernetes cluster. We’ll now see the Quarkus app container running within a pod on our cluster with a service already set up (Figure 15). We also have the ability to create an OpenShift route to access our application externally.

    $ odo dev
    Viewing the deployment of an application in OpenShift.
    Figure 15. Iterating and viewing the deployment of our application in OpenShift.

    With odo, you can easily iterate your application against the Kubernetes or OpenShift cluster, as well as test and debug without having a deep understanding of the platform. For more advanced topics, feel free to head to the documentation site to learn about topics such as connecting to a service, running applications using odo in a production environment, and troubleshooting.

    Summary

    In short, odo makes it easy to navigate the complex world of Kubernetes, providing first-class deployment support for Podman and Kubernetes. With just a few simple commands, developers can set up their projects, make live updates, and odo will handle your application's building, pushing, and deployment. Be sure to check out the open source project at odo.dev, star the project on GitHub, and give it a try!

    Related Posts

    • How odo 3.0 GA improves the developer experience

    • Set up an OpenShift cluster to deploy an application in odo CLI

    • How to use odo the developer-centric CLI with OpenShift 4

    Recent Posts

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    • Configure a split disk on OpenShift Container Platform

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    What’s up next?

    As a developer, you want to develop software without the overhead of do-it-yourself operations. With odo, the OpenShift CLI, you can develop cloud-native applications without learning dozens of commands. Our odo cheat sheet provides the commands you need to get started.

    Get the cheat sheet
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.