KONG Gateway
Abhishek Ankush
Architect | Tech blogger | Certified Safe 5 Agile practitioner | DevOps | Cloud computing | Web development
Kong Gateway is an API Gateway and microservices management layer that provides high-performance traffic control, security, and analytics for APIs and microservices. It is widely used to manage, route, and secure API traffic efficiently.?
Key Concepts:
Benefits of using Kong:
Kong Gateway Application structure:
Kong Gateway installation:
Kong Gateway can be installed in various environments, including Docker, Kubernetes, and traditional virtual machines. The installation steps vary based on the deployment method:
Installation on?Docker:
docker run -d - name kong \
-e KONG_DATABASE=off \
-e KONG_PROXY_ACCESS_LOG=/dev/stdout \
-e KONG_ADMIN_ACCESS_LOG=/dev/stdout \
-e KONG_PROXY_ERROR_LOG=/dev/stderr \
-e KONG_ADMIN_ERROR_LOG=/dev/stderr \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong
Kong Gateway deployment Modes:
Hybrid mode of deployment with Kong?Konnect:
In a self-managed hybrid gateway deployment, Kong separates the Control Plane (CP) and Data Plane (DP) to optimize API management across different environments while maintaining security and scalability.
Key Components:
Control Plane (CP):
Data Plane (DP):
Benefits:
领英推荐
Deployment Steps:
Deploy the Control Plane:
KONG_DATABASE=postgres \ KONG_ROLE=control_plane \ KONG_CLUSTER_CERT=/path/to/cert \ KONG_CLUSTER_CERT_KEY=/path/to/key \ kong star
Deploy the Data Plane:
KONG_DATABASE=off \ KONG_ROLE=data_plane \ KONG_CLUSTER_CONTROL_PLANE=cp_host:cp_port \ KONG_CLUSTER_CERT=/path/to/cert \ KONG_CLUSTER_CERT_KEY=/path/to/key \ kong start
Verify Synchronization:
Kong Gateway configuration:
Configuring Kong
Kong can be configured via its configuration file, environment variables, or the Admin API. Some key configuration options include:
Example Configuration File (kong.conf):
# Database settings
database = off # Use 'postgres' for database-backed mode
# Admin API settings
admin_listen = 0.0.0.0:8001
# Proxy settings
proxy_listen = 0.0.0.0:8000
Kong Gateway?Plugin:
What are Plugins?
Plugins are middleware components that extend Kong’s functionality. They can be used for authentication, security, traffic control, and logging.
Common Plugins:
Example: Enabling Rate Limiting?Plugin
curl -X POST https://localhost:8001/services/{service}/plugins \
--data "name=rate-limiting" \
--data "config.second=5" \
--data "config.minute=100"
Securing Kong?Gateway
Security Best Practices
Enforcing Authentication with Key Auth
curl -X POST https://localhost:8001/services/{service}/plugins \
--data "name=key-auth"
API Request and Response?Flow:
Learnings with Kong Academy:
For further reading register by using your email address and Enroll in the below recommended courses.
● KGAC-101: Kong Gateway Foundations
● KDAC-201: Kong for Developers
● KGLL-115: Getting Started with Konnect Gateway
● KGLL-118: Introduction to Kong Gateway
● KGLL-120: Introduction to Kong Plugins
This article refers to Kong Academy learnings for images and contents.?
If you liked this article, please ?? below, so that other people can find it! ??