How a single operator can transform the way you discover, manage, and interact with APIs across your Kubernetes clusters
![Header Image: A unified dashboard showing multiple API endpoints in one interface]
If you've ever worked with microservices in Kubernetes, you know the pain: dozens of services, each with its own API documentation scattered across different endpoints, different formats, and often buried in Kubernetes configurations that are hard to navigate. As your cluster grows, so does the chaos of managing API documentation.
What if I told you there's a way to automatically discover all your APIs, aggregate their documentation, and present them in a beautiful, unified Swagger UI interface? Enter the OpenAPI Aggregator Operator — a Kubernetes-native solution that brings order to API chaos.
Picture this: You're a developer joining a new team. Your mission? Understand the 15 microservices running in the production Kubernetes cluster. Each service has its own API, its own documentation format, and its own way of being accessed. You spend hours:
- Port-forwarding to individual services
- Hunting down API documentation URLs
- Switching between different Swagger UI instances
- Trying to remember which service does what
Sound familiar? This is the reality for most teams running microservices architectures.
The OpenAPI Aggregator Operator solves this problem elegantly by introducing two key concepts:
- Automatic API Discovery — It watches your Kubernetes services and automatically finds those exposing OpenAPI/Swagger specifications
- Unified Interface — It aggregates all discovered APIs into a single, beautiful Swagger UI interface
Think of it as having a personal assistant that continuously monitors your cluster, finds all your APIs, and maintains an up-to-date catalog that you can browse from one place.
The operator introduces two custom resources that work together:
This is your API hunter. You tell it where to look (which namespaces), and it continuously scans for services that have been marked with a simple annotation:
metadata:
annotations:
openapi.aggregator.io/swagger: "true"That's it! Any service with this annotation gets automatically discovered and its API specification is collected.
This component takes all the discovered APIs and presents them in a clean, unified Swagger UI. No more juggling multiple browser tabs or trying to remember which port-forward command you need.
New team members can instantly see all available APIs in your cluster without needing to ask "Where's the documentation for service X?"
QA engineers and developers can test APIs directly from the centralized interface, making it easy to validate integrations and debug issues.
Platform teams can easily audit which services expose APIs, ensure documentation standards are met, and identify undocumented services.
Different teams can discover and understand each other's APIs without complex setup procedures or tribal knowledge.
Let's walk through setting this up in your cluster. Don't worry — it's surprisingly simple.
kubectl apply -f https://raw.githubusercontent.com/hellices/openapi-aggregator-operator/main/install.yamlThis installs the operator in your cluster. No complex configurations needed.
For each service that exposes an API, add a simple annotation:
apiVersion: v1
kind: Service
metadata:
name: user-service
annotations:
openapi.aggregator.io/swagger: "true"
openapi.aggregator.io/path: "/api-docs" # Optional: defaults to /v2/api-docs
openapi.aggregator.io/port: "8080" # Optional: defaults to 8080
spec:
ports:
- port: 8080
targetPort: 8080
selector:
app: user-serviceDeploy an OpenAPIAggregator resource to start the discovery process:
apiVersion: observability.aggregator.io/v1alpha1
kind: OpenAPIAggregator
metadata:
name: my-api-aggregator
namespace: default
spec:
# Watch services in all namespaces
watchNamespaces: [""]
defaultPath: "/v2/api-docs"
defaultPort: "8080"Create a SwaggerServer to provide the unified interface:
apiVersion: observability.aggregator.io/v1alpha1
kind: SwaggerServer
metadata:
name: api-dashboard
namespace: default
spec:
port: 9090kubectl port-forward svc/api-dashboard 9090:9090Open http://localhost:9090 in your browser, and voilà! All your APIs in one beautiful interface.
You can fine-tune which namespaces to scan:
spec:
# Only watch specific namespaces
watchNamespaces: ["production", "staging"]Expose your API dashboard through an ingress for team-wide access:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-dashboard
spec:
rules:
- host: apis.yourcompany.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-dashboard
port:
number: 9090Control which HTTP methods are exposed:
metadata:
annotations:
openapi.aggregator.io/allowed-methods: "get,post"Under the hood, the operator follows Kubernetes best practices:
- Controller Pattern: Two controllers watch for their respective custom resources
- ConfigMap Storage: Discovered API metadata is stored in a ConfigMap
- Decoupled Design: Discovery and presentation are separate concerns
- Real-time Updates: Changes to your services are reflected immediately
This isn't just about convenience (though that's a huge win). It's about:
- Reducing Cognitive Load: Developers can focus on building, not hunting for documentation
- Improving API Quality: When APIs are visible, they tend to be better documented
- Enabling Self-Service: Teams can discover and use each other's APIs independently
- Supporting Governance: Platform teams gain visibility into their API landscape
The operator respects Kubernetes RBAC. It only watches resources it has permission to see.
The operator is lightweight and designed to scale with your cluster. It only processes services with the required annotations.
Built on the battle-tested controller-runtime framework, it's designed for production workloads.
The OpenAPI Aggregator Operator is actively developed with features like:
- Enhanced filtering capabilities
- Custom UI themes
- Metrics and monitoring integration
- Multi-cluster support
The best way to understand the value is to try it yourself. The operator is:
- ✅ Open source (Apache 2.0 license)
- ✅ Production-ready
- ✅ Easy to install and remove
- ✅ Well-documented
Get started: https://github.com/hellices/openapi-aggregator-operator
Managing APIs in Kubernetes doesn't have to be chaotic. With the OpenAPI Aggregator Operator, you can transform your scattered API landscape into a unified, discoverable, and maintainable system.
Your future self (and your teammates) will thank you.
Want to see more Kubernetes solutions like this? Follow me for more insights on simplifying cloud-native development.
Resources:
Tags: #Kubernetes #API #Microservices #DevOps #OpenAPI #Swagger #CloudNative #Operator