Skip to content

dotcomrow/k8s-api-gateway

Repository files navigation

πŸš€ Gravitee API Management Platform

Kubernetes Gravitee YugabyteDB Vault APISIX

Complete API Management Platform with developer portal, access workflows, and integrated gateway - replacing Backstage while preserving infrastructure investments.

🎯 What This Provides

  • 🌐 Developer Portal: Self-service API discovery and access requests
  • ⚑ High-Performance Gateway: APISIX-powered API runtime with policies
  • πŸ” Enterprise Security: Vault-managed secrets with Kubernetes RBAC
  • πŸ“Š Service Discovery: Automatic API catalog from Kubernetes annotations
  • πŸ—„οΈ Distributed Database: YugabyteDB for high availability and scalability

πŸ—οΈ Architecture

External Traffic β†’ APISIX Gateway β†’ Gravitee Services β†’ YugabyteDB
                      ↓
                  Portal Routes:
                  /portal/*     β†’ Developer Portal UI
                  /management/* β†’ Admin API
                  /gateway/*    β†’ Runtime API Gateway

πŸ“ Project Structure

k8s-api-gateway/
β”œβ”€β”€ πŸ“‹ Deployment
β”‚   β”œβ”€β”€ manifests/
β”‚   β”‚   β”œβ”€β”€ api-gateway-gravitee.yaml    # πŸ†• Complete Gravitee platform (1,429 lines)
β”‚   β”‚   └── api-gateway.yaml             # Original mixed Backstage/Gravitee
β”‚   └── gravitee-deployments.yaml       # Standalone Gravitee components
β”‚
β”œβ”€β”€ πŸ”¨ Build System  
β”‚   β”œβ”€β”€ build-gravitee-images.sh         # πŸ†• Docker build automation
β”‚   └── src/
β”‚       β”œβ”€β”€ Dockerfile.gravitee          # πŸ†• Multi-stage Gravitee builds
β”‚       β”œβ”€β”€ Dockerfile.backstage         # Original Backstage build
β”‚       └── gravitee-config/             # πŸ†• Configuration templates
β”‚           β”œβ”€β”€ management-api/gravitee.yml
β”‚           β”œβ”€β”€ gateway/gravitee.yml
β”‚           └── portal/constants.json
β”‚
β”œβ”€β”€ πŸ“š Documentation
β”‚   β”œβ”€β”€ README.md                        # This file
β”‚   β”œβ”€β”€ ARCHITECTURE.md                  # πŸ†• System architecture details  
β”‚   β”œβ”€β”€ GRAVITEE_SETUP.md               # πŸ†• Technical setup guide
β”‚   β”œβ”€β”€ GRAVITEE_DEPLOYMENT_GUIDE.md    # πŸ†• Step-by-step deployment
β”‚   └── MIGRATION_COMPLETE.md           # πŸ†• Migration summary
β”‚
└── πŸ”§ Utilities
    └── verify-migration.sh              # πŸ†• Deployment verification script

πŸš€ Quick Start

1. Verify Setup

./verify-migration.sh

2. Build Images

./build-gravitee-images.sh

3. Deploy Platform

kubectl apply -f manifests/api-gateway-gravitee.yaml

4. Monitor Deployment

kubectl get pods -n k8s-api-gateway -w

5. Access Portal

# Get APISIX endpoint
kubectl get svc -n k8s-api-gateway apisix

# Access Gravitee Portal
open http://<apisix-host>/portal/

βš™οΈ Core Components

Component Port Purpose Replicas
Gravitee Portal 8080 Developer portal UI 1
Management API 8083 Admin backend 1
Gravitee Gateway 8082 API runtime engine 2
APISIX Gateway 9080/9443 Traffic routing 2
APISIX Admin 9180 Gateway config -
etcd 2379 APISIX storage 1

πŸ” Security Features

  • πŸ”’ Vault Integration: All secrets managed by HashiCorp Vault
  • πŸ‘€ RBAC: Kubernetes role-based access control
  • πŸ›‘οΈ Service Accounts: Dedicated permissions per component
  • πŸ”‘ JWT Authentication: Token-based portal access
  • 🌐 CORS Support: Cross-origin resource sharing
  • πŸ“‹ Audit Trail: Complete API access logging

πŸ” Service Discovery

Add annotations to your Kubernetes services for automatic API catalog population:

metadata:
  annotations:
    gravitee.io/definition-context-path: "/api/v1/my-service"
    gravitee.io/definition-summary: "My Service API" 
    gravitee.io/definition-description: "Detailed service description"
    gravitee.io/definition-version: "1.0.0"
    gravitee.io/definition-groups: "internal,public"

πŸ“Š Key Benefits

βœ… Vs Backstage

  • Simpler: No complex plugin ecosystem
  • Faster: Purpose-built for API management
  • Reliable: No pg-native compatibility issues
  • Feature-Rich: Native API portal capabilities

βœ… Preserved Infrastructure

  • YugabyteDB: Same distributed database (new schema)
  • HashiCorp Vault: Identical secrets management
  • Kubernetes RBAC: Same security model
  • Docker: Same build patterns and registry

πŸ› οΈ Operations

Health Checks

# Check all services
kubectl get pods -n k8s-api-gateway

# Verify setup jobs completed  
kubectl get jobs -n k8s-api-gateway

# Test portal access
curl http://<apisix-host>/portal/

Logs & Troubleshooting

# Gravitee services
kubectl logs -n k8s-api-gateway deployment/gravitee-management-api
kubectl logs -n k8s-api-gateway deployment/gravitee-gateway  
kubectl logs -n k8s-api-gateway deployment/gravitee-portal

# APISIX gateway
kubectl logs -n k8s-api-gateway deployment/apisix

# Database setup
kubectl logs -n k8s-api-gateway job/setup-yugabyte-gravitee-db

Scaling

# Scale Gravitee Gateway for higher throughput
kubectl scale -n k8s-api-gateway deployment/gravitee-gateway --replicas=3

# Scale APISIX for more concurrent connections
kubectl scale -n k8s-api-gateway deployment/apisix --replicas=3

πŸ“ˆ What's Next

  1. 🎨 Customize Portal: Brand the developer portal for your organization
  2. πŸ“‹ Configure Workflows: Set up API access approval processes
  3. πŸ” Add APIs: Annotate services for automatic discovery
  4. πŸ“Š Enable Monitoring: Add observability and metrics collection
  5. πŸ”’ Enhance Security: Implement additional authentication providers

πŸ“š Documentation

πŸŽ‰ Migration Complete

Successfully migrated from Backstage to Gravitee.io while preserving all infrastructure investments and enhancing API management capabilities. The platform is ready for production deployment with comprehensive documentation and automation.

Ready to deploy? See GRAVITEE_DEPLOYMENT_GUIDE.md for step-by-step instructions.

About

K8s api gateway setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published