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

Deploy and bind enterprise-grade microservices with Kubernetes Operators

May 18, 2020
Arthur De Magalhaes
Related topics:
CI/CDKubernetesMicroservicesOperators
Related products:
Red Hat Advanced Cluster Management for KubernetesRed Hat Advanced Cluster Security for Kubernetes

    Deploying enterprise-grade runtime components into Kubernetes can be daunting. You might wonder:

    • How do I fetch a certificate for my app?
    • What's the syntax for autoscaling resources with the Horizontal Pod Autoscaler?
    • How do I link my container with a database and with a Kafka cluster?
    • Are my metrics going to Prometheus?
    • Also, how do I scale to zero with Knative?

    Operators can help with all of those needs and more. In this article, I introduce three Operators—Runtime Component Operator, Service Binding Operator, and Open Liberty Operator—that work together to help you deploy containers like a pro.

    Runtime Component Operator: A personal assistant for your microservices

    What better way to upgrade your microservice to executive status than to provide it with a personal assistant? Besides sounding cool, it will make your Kubernetes deployment a lot easier.

    To get started, go to OperatorHub.io. Note the Operator categories in the drop-down list to the left of your screen. Click the link for Application Runtime Operators, then filter that to just the two Auto-Pilot entries under Capability Level. (These are Level 5, the highest level on OperatorHub.) You will see two options: Runtime Component Operator and Open Liberty Operator.

    The two tools are related: Runtime Component Operator is the upstream community that fuels Open Liberty Operator. I'll introduce Runtime Component Operator first. Later in the article, I'll introduce a couple of Open Liberty Operator's unique features.

    Overview of Runtime Component Operator

    As shown in Figure 1, Runtime Component Operator lets you deploy any runtime container—Liberty, JBoss, Quarkus, Node.js, Spring Boot, and so on.

    A flow diagram of Runtime Component Operator in a Kubernetes deployment.
    Figure 1. Runtime Component Operator in a Kubernetes deployment.

    Runtime Component Operator can assist you with any of the following everyday deployment activities:

    • Creating and deploying k8s resources.
    • Toggling to create Knative or serverless resources.
    • Deploying an image from an image stream (including integration with BuildConfig).
    • Autoscaling with Horizontal Pod Autoscaler.
    • Managing resource constraints.
    • Integrating with Prometheus (it's built-in).
    • Integrating with a certificate manager.
    • Creating routes with Transport Layer Security (TLS).
    • Implementing TLS between microservices.
    • Probing for readiness or liveness.
    • Setting up environment variables.
    • Setting up easy two-step volume persistence.
    • Integrating with kAppNav and Red Hat OpenShift's topology view
    • Binding app-to-app services.
    • Binding app-to-resource services.

    And that's just the shortlist. See the Runtime Component Operator User Guide for more details.

    Next, let's look at how Runtime Component Operator helps you solve real-world problems.

    Mutual TLS trust

    Let's say that you wanted to deploy two or more microservices that have established mutual TLS trust. You plan on using certificates issued by a cluster certificate authority (CA). You could try to set up the deployment manually, or you could simply use a configuration like this:

    apiVersion: app.stacks/v1beta1
    kind: RuntimeComponent
    metadata:
      name: my-app
      namespace: test
    spec:
      applicationImage: registry.connect.redhat.com/ibm/open-liberty-samples:springPetClinic
      service:
        port: 9080
        certificate: {}
    

    Image streams

    For another example, let's say that you want to deploy an image stream (perhaps as the result of a BuildConfig) using Knative. This simple configuration achieves it:

    apiVersion: app.stacks/v1beta1
    kind: RuntimeComponent
    metadata:
      name: my-app
      namespace: test
    spec:
      applicationImage: my-namespace/my-image-stream:1.0
      createKnativeService: true
      expose: true
    

    With one toggle (createKnativeService), you can switch from using vanilla Kubernetes resources to Knative (serverless) resources. The expose element automatically creates a route for your microservice.

    Connecting RESTful services

    Now let's say that you want to connect two or more RESTful services. Not a problem. Just let Runtime Component Operator know that you want to expose or consume a service, like this:

    apiVersion: app.stacks/v1beta1
    kind: RuntimeComponent
    metadata:
      name: my-provider
      namespace: test
    spec:
      applicationImage: appruntime/samples:service-binding-provider
      service:
        port: 9080
        provides:
          category: openapi
          context: /my-context
    

    In this case, the YAML deploys the providing microservice and makes itself bindable to other microservices, which can then request the binding:

    apiVersion: app.stacks/v1beta1
    kind: RuntimeComponent
    metadata:
      name: my-consumer
      namespace: test
    spec:
      applicationImage: appruntime/samples:service-binding-consumer
      service:
        port: 9080
        consumes:
          - category: openapi
            name: my-provider
    

    That's all you need to do. Runtime Component Operator will inject the requested binding information into the consuming microservice.

    That's impressive, but what if you needed to bind to resources that Runtime Component Operator didn't own? Next, I'll show you how to use the new Service Binding Specification and Red Hat Service Binding Operator for just that scenario.

    Service Binding Specification: Bring order to your bindings

    A few months ago, a new community formed to standardize service bindings within Kubernetes. This collaboration has resulted in the first release candidate of the Service Binding Specification.

    This specification focuses on the following questions related to service bindings:

    • How do we make something bindable?
    • What is the binding schema to be exposed to?
    • How do we request a binding?
    • How is the binding data injected or mounted into the microservice?

    The specification expands each of these topics in detail—for example, it thoroughly illustrates the data model based on x-descriptors and annotations.

    Red Hat Service Binding Operator

    A specification is useful for creating a consistent path for service producers and consumers to follow. Having a reference implementation is even better. Red Hat Service Binding Operator works together with Runtime Component Operator to improve service binding in Kubernetes deployments.

    Service Binding Operator is at the center of the binding: It watches for and manages incoming ServiceBindingRequest custom resources (CRs). These are YAML artifacts that describe the services we are binding.

    Out-of-the-box, Service Binding Operator processes specification-compliant annotations from bindable services. It also has a very useful autoDetect mode that allows it to walk through owned Secrets, ConfigMaps, Routes, and so on. It can then expose the binding data extracted from those resources. This "zero code change" approach is a great way to work with existing services, even before they adhere to the new Service Binding Specification.

    Runtime Component Operator's role is to detect (automatically or via a reference) a ServiceBindingRequest that links to one of its deployed microservices. It will then inject or mount the corresponding information.

    Check out the "Service Binding" section of the Runtime Component Operator User Guide for more information about deploying Runtime Component Operator and Service Binding Operator together.

    A quick demonstration

    If you want to see how these two Operators work together, check out our sample application: Binding a PostgreSQL Operator database to a Spring Boot application. An Operator manages the PostgreSQL Operator database, and the Spring Boot app is deployed and managed by Runtime Component Operator using Service Binding Operator.

    In the demo, we start by deploying a Database CR, which is used by the PostgreSQL Operator to create our database.

    Next, we deploy a ServiceBindingRequest CR that gets processed by the Service Binding Operator.

    Last, we deploy our RuntimeComponent CR (in this case, a Spring Boot microservice), which is managed by the Runtime Component Operator.

    Future enhancements

    Future enhancements will include being able to generate a ServiceBindingRequest CR from a given RuntimeComponent CR. Figure 2 shows the pattern we want to achieve:

    A flow diagram of Service Binding Operator generating a ServiceBindingRequest CR from a given RuntimeComponent CR.

    Figure 2. Service Binding Operator generates a ServiceBindingRequest CR from a given RuntimeComponent CR.">

    The application code could then safely navigate all of its bindings via the top-level SERVICE_BINDINGS environment variable, which would look something like this:

    SERVICE_BINDINGS = {
      "bindingKeys": [
        {
          "name": "KAFKA_USERNAME",
          "bindAs": "envVar"
        },
        {
          "name": "KAFKA_PASSWORD",
          "bindAs": "volume",
          "mountPath": "/platform/bindings/secret/"
        }
      ]
    }
    

    Open Liberty Operator: Optimize your deployments

    At the beginning of this article, I noted that Runtime Component Operator is the upstream project for Open Liberty Operator. Everything you've seen so far, in terms of capabilities and bindings, applies to Open Liberty Operator.

    Even better, if you know the runtime is Open Liberty, you can use a configuration in Open Liberty Operator for features that are specific to that runtime. We'll look at two of these capabilities.

    Liberty's SSO integration

    Open Liberty Operator supports Liberty's single sign-on (SSO) Social Media Login feature. Because of this, it can delegate authenticating an application user to an external provider such as Google, Facebook, LinkedIn, Twitter, GitHub, or any OpenID Connect (OIDC) or OAuth 2.0 client.

    Your first step is to enable the Social Media Login in your code. Once you have done that, you can create the appropriate social media login secrets (such as a GitHub clientID) and configure your OpenLibertyApplication deployment to wire it all together. You can find detailed information and code samples in the Open Liberty Operator User Guide.

    Day-2 Operations

    The Day-2 Operations feature is a popular Open Liberty runtime feature for gathering traces and triggering a JVM dump. In Open Liberty Operator, each of these actions is available in a highly specialized custom resource definition (CRD), which ensures a minimalist user experience.

    Here's a quick look at how you would set a trace:

    apiVersion: openliberty.io/v1beta1
    kind: OpenLibertyTrace
    metadata:
      name: example-trace
    spec:
      podName: my-pod
      traceSpecification: "*=info:com.ibm.ws.webcontainer*=all"
      maxFileSize: 20
      maxFiles: 5
    

    As you can see, the code is straightforward and intuitive for Open Liberty users. Visit the Open Liberty Operator User Guide for complete configuration details.

    Ready to get started?

    Both Runtime Component Operator and Open Liberty Operator are available from the Red Hat OpenShift OperatorHub. You can quickly install them cluster-wide, or you could use a namespace-scoped installation via the Operator Lifecycle Manager (OLM) framework. Both Operators are open source, so there are no usage restrictions. Grab your favorite runtime component and give it a try with one of these Operators—you'll notice the enterprise boost right away.

    When you are ready to move into a production scenario and want support, I encourage you to check out Red Hat Runtimes, which contains Open Liberty.

    Last updated: June 22, 2023

    Recent Posts

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

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

    • How to manage TLS certificates used by OpenShift GitOps operator

    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.