Jump to section

Spring on Kubernetes with Red Hat OpenShift

Copy URL

Red Hat® OpenShift® allows you to develop and run Kubernetes-native Spring and Spring Boot applications.

Spring apps can rely on Kubernetes and capabilities deployed to it to provide the needed cloud services that enable efficient development on Kubernetes. This includes services like message queues, databases, persistence storage, and caching, among others.

Service registry

Microservice architectures often imply dynamic scaling of individual services, in a private, hybrid or public cloud where the number and address of hosts cannot always be predicted or statically configured in advance. In Kubernetes, service replication and scaling is a core feature. This means that the client does not need to keep a cache and account for the failure of the service registry itself. For example, Netflix Ribbon (often used with Spring apps) can be declaratively configured to use Kubernetes instead of a service registry, without any code changes.

Load balancing

For client calls to stateless services in Spring apps, high availability (HA) translates to a need to look up the service from a service registry, and load balance among available instances. Kubernetes provides a single service address where calls will be load balanced and redirected to an appropriate instance. Within a Kubernetes cluster, the service name resolves to this cluster IP address and can be used to reach the load balancer. For calls from outside and when going through the router is not desirable, an external IP address can be configured for the service.

Fault tolerance

The highly distributed nature of microservices implies a higher risk of failure of a remote call, as the number of such remote calls increases. Historically, the burden of implementing fault tolerance patterns like a circuit breaker has fallen to the developer. However, projects like Istio that implement a service mesh can alleviate this burden and provide much greater operational control over Spring services running in the cluster.

Externalized configuration

Externalized configuration management solutions can provide an elegant alternative to the typical combination of configuration files, command line arguments, and environment variables that are used to make applications more portable and less rigid in response to outside changes. Kubernetes ConfigMaps can be used to store fine-grained information like individual properties, or coarse-grained information like entire configuration files or JSON blobs. They provide mechanisms to inject containers with configuration data, keeping configuration separate from but accessible to Spring apps using annotations like @ConfigProperty.

Distributed tracing and application metrics

For all its advantages, a microservice architecture can be difficult to analyze and troubleshoot. Each business request spawns multiple calls to, and between, individual services at various layers. Distributed tracing ties all individual service calls together, and associates them with a business request through a unique generated ID. Going further, metrics enable Spring apps to expose application-level data to enable fine-grained examination of the state of an application. Tracing tools like Jaeger, combined with a metrics stack with Prometheus and Grafana provide a solid foundation for monitoring and troubleshooting Spring apps on Kubernetes.

As Spring applications evolve into collections of decentralized services, managing communications and security between those services becomes more difficult. Red Hat OpenShift combined with Red Hat Runtimes provides Spring developers with the tooling, frameworks and native Kubernetes integrations necessary to build and manage Spring applications at scale on the industry's leading container and Kubernetes hybrid cloud platform.

There are many benefits for Spring developers using Red Hat OpenShift. These include:

Using Spring Boot on OpenShift provides a natural “Spring Boot on Kubernetes” developer experience for both existing and net-new Spring apps.

  • Support for building cloud-native applications with Spring and Spring Boot
  • Integrates Kubernetes features that replace traditional standalone backing services
    • Externalized Configuration: Kubernetes ConfigMap and integration with Spring Cloud Kubernetes
    • Service Discovery: Kubernetes Services
    • Load Balancing: Kubernetes Replication Controller
    • Auto-Restart: Kubernetes Health Probes and integration with Spring Actuator
    • Metrics: Prometheus, Grafana, and integration with Spring Cloud Sleuth
    • Distributed Tracing with Istio & Jaeger Tracing
  • Developer tooling through Red Hat OpenShift to quickly scaffold new Spring projects, gain access to familiar Spring APIs in your favorite IDE, and deploy to Red Hat OpenShift

Use familiar Spring APIs and gain the benefits of the underlying Kubernetes platform and services in Red Hat OpenShift and Red Hat Application Services.

Use Spring knowledge to develop modern apps using the latest in technology.

Keep reading

Article

What are Red Hat OpenShift Operators?

Red Hat OpenShift Operators automate the creation, configuration, and management of instances of Kubernetes-native applications.

Article

AI/ML on Red Hat OpenShift

OpenShift includes key capabilities to accelerate AI/ML workflows and deliver AI-powered intelligent applications 

Article

Edge computing with Red Hat OpenShift

Extend application services to remote locations and analyze inputs in real time with OpenShift’s edge computing capabilities.

More about OpenShift

Products

Red Hat® OpenShift® provides a centralized collaboration platform to help your organization scale DevOps.

Red Hat® Developer Hub provides the tools to build an internal developer platform, a critical part of maintaining a DevOps culture.

Red Hat® Trusted Software Supply Chain helps organizations build security into the software development life cycle from the start.

Red Hat® Ansible® Automation Platform automates the major stages of CI/CD pipelines, becoming the activating tool of DevOps methodologies.

Resources

Training

Free training course

Running Containers with Red Hat Technical Overview

Free training course

Developing Cloud-Native Applications with Microservices Architectures

Free training course

Containers, Kubernetes and Red Hat OpenShift Technical Overview

Interactive labs

Learn about Red Hat® OpenShift with step-by-step interactive lessons designed for hands-on practitioners.