A logo showing the text blog.marcnuri.com
Español
Home»Cloud Native»Kubernetes 1.19 Ingress API from Java using YAKC

Recent Posts

  • Fabric8 Kubernetes Client 7.4 is now available!
  • Kubernetes MCP Server Joins the Containers Organization!
  • MCP Tool Annotations: Adding Metadata and Context to Your AI Tools
  • Fabric8 Kubernetes Client 7.2 is now available!
  • Connecting to an MCP Server from JavaScript using AI SDK

Categories

  • Artificial Intelligence
  • Backend Development
  • Cloud Native
  • Engineering Insights
  • Frontend Development
  • JavaScript
  • Legacy
  • Operations
  • Personal
  • Pet projects
  • Quality Engineering
  • Tools

Archives

  • September 2025
  • July 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • August 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • October 2019
  • September 2019
  • July 2019
  • March 2019
  • November 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • December 2017
  • October 2017
  • August 2017
  • July 2017
  • January 2017
  • December 2015
  • November 2015
  • December 2014
  • March 2014
  • February 2011
  • November 2008
  • June 2008
  • May 2008
  • April 2008
  • January 2008
  • November 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007

Kubernetes 1.19 Ingress API from Java using YAKC

2020-08-30 in Cloud Native tagged Client / Cloud / Ingress / Java / Kubernetes / OpenShift / YAKC by Marc Nuri | Last updated: 2025-08-29
Versión en Español

Introduction

Kubernetes v1.19.0 was just released. Amongst the many new features and improvements, the graduation of Ingress API to V1 (#1453) stands out.

Despite users have widely adopted Ingress resources, and that Kubernetes introduced the beta feature back in 2015 (v1.1), it hasn't been until the new v1.19 release that Ingress has gone GA.

An Ingress is "An API object that manages external access to the services in a cluster, typically HTTP". In other words, Ingresses are the way to publicly expose your Kubernetes managed Services to the outer world.

In this post, I will show you how to use YAKC to create a new Ingress using the new v1 API introduced in Kubernetes v1.19.0.

An image of a diagram of YAKC interacting with Kubernetes Ingress API
An image of a diagram of YAKC interacting with Kubernetes Ingress API

Ingress from Java

You can use Ingresses to provide external reachable URLs, and traffic load balancing to Service resources. In addition, Ingress resources are useful if you want to provide name-based virtual hosting capabilities and SSL termination.

The Ingress resource requires an IngressController to be used. Kubernetes currently officially supports and maintains GCE and NGINX controllers.

Note that Ingress v1 introduces several changes to v1beta1, most notably, the pathType field is now required and no longer provides a default value.

The following YAML describes an Ingress using en existent NGINX IngressController:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
 name: ingress-example
 namespace: default
spec:
 ingressClassName: nginx
 rules:
   - host: "*.foo.com"
     http:
       paths:
         - path: /
           pathType: Exact
           backend:
             serviceName: path-exact
             servicePort: 80

You can achieve the exact same result using YAKC:

new KubernetesClient().create(NetworkingV1Api.class).createNamespacedIngress("default", Ingress.builder()
  .metadata(ObjectMeta.builder()
    .name("ingress-example")
    .build())
  .spec(IngressSpec.builder()
    .addToRules(IngressRule.builder()
      .host("*.foo.com")
      .http(HTTPIngressRuleValue.builder()
        .addToPaths(HTTPIngressPath.builder()
          .path("/")
          .pathType("Exact")
          .backend(IngressBackend.builder()
            .service(IngressServiceBackend.builder()
              .name("path-exact")
              .port(ServiceBackendPort.builder()
                .number(80)
                .build())
              .build())
            .build())
          .build())
        .build())
      .build())
    .build())
  .build()
).get();

The main advantage of using Java (YAKC Kubernetes Client) is that you can perform these tasks dynamically. For instance, you can implement a Java-based Operator that will automatically create an Ingress whenever a Service gets created.

Conclusion

Kubernetes 1.19 marks the general availability of Ingress networking.k8s.io/v1. In this post, I've shown you how to use YAKC to create an Ingress using Java.

You can learn more by visiting YAKC's GitHub project site. You can also see related code here.

Twitter iconFacebook iconLinkedIn iconPinterest iconEmail icon

Post navigation
React + Quarkus integration using MavenQuarkus + JKube: Qute template with markdown processing from different sources
© 2007 - 2025 Marc Nuri