Networking Overview
| Type | Purpose | Configuration | Security |
|---|---|---|---|
| Private | Service-to-service communication | Automatic | Internal only |
| Public HTTPS | Web traffic with TLS | Port 443 | Automatic TLS |
| Public TCP | Non-HTTP protocols | Custom port | No TLS by default |
Private Networking (Service Discovery)
All services in the same environment can communicate privately using automatic service discovery.How It Works
Automatic DNS:- Every service gets a hostname
- Internal DNS resolves service names to IP addresses
- No manual configuration required
- PostgreSQL:
postgres:5432 - Redis:
redis:6379 - API service:
api:3000 - WebSocket server:
websocket:8080
Connection Strings
Use service names in connection strings:Private networking currently only works within the same environment. Services in “production” cannot reach services in “staging”.
Public Networking
Public networking exposes services to the internet. Suga offers two modes: HTTPS and TCP Proxy.HTTPS Endpoints
HTTPS endpoints provide secure web access with automatic TLS certificates. All HTTPS traffic goes through Cloudflare’s global CDN. Features:- Port 443 (HTTPS)
- Automatic TLS certificates via Cloudflare
- Cloudflare CDN, WAF, and DDoS protection
- Auto-generated domain names
- Load balancing across replicas
Add HTTPS Domain
In the Public Network section, click Add Endpoint and select HTTPS Domain. Specify the private port your application listens on (e.g., 3000, 8080). Ensure this port is listed under Private Network → Ports. Public HTTPS traffic on port 443 routes to this private port.
TCP Proxy
TCP proxy exposes non-HTTP protocols to the internet. Use Cases:- Direct database access (PostgreSQL, MySQL)
- SSH connections
- Custom protocols (MQTT, gRPC, WebSocket)
- Game servers
- Any TCP port
- Allocated load balancer port
- No automatic TLS (use application-level encryption)
Add TCP Proxy
In the Public Network section, click Add Endpoint and select TCP Proxy. Enter the port your application listens on (e.g., 5432 for PostgreSQL). Ensure this port is listed under Private Network → Ports.
Load Balancing
For services with multiple replicas, Suga automatically load balances traffic: HTTPS Endpoints:- Round-robin load balancing across replicas
- Round-robin load balancing
- Connection-level distribution
- Kubernetes internal service load balancing
- Distributes connections across all replicas
Load balancing is automatic. You don’t need to configure it manually.
WebSocket Support
WebSockets work automatically with HTTPS endpoints: Setup:- Configure your application to listen for WebSocket connections
- Enable HTTPS on the service
- Deploy
- Connect using
wss://(secure WebSocket)
Network Isolation
Between Environments:- Services in different environments (production, staging, dev) cannot communicate
- Each environment is a separate Kubernetes namespace
- For cross-environment communication, use public networking
- Services in different projects cannot communicate privately
- Use public networking (HTTPS/TCP) for cross-project communication
- Private networking is internal-only (not exposed to internet)
- Public networking requires explicit configuration
- Automatic TLS for HTTPS endpoints
Common Patterns
Web Application
Frontend talks to backend, backend talks to database: Configuration:frontend: HTTPS enabled (public)api: HTTPS enabled (public)postgres: No public networking (private only)apiconnects topostgresviapostgres:5432
Microservices
Multiple services communicate privately, one acts as public gateway: Configuration:gateway: HTTPS enabled (public)users,orders,products: No public networking (private only)- Gateway connects to services via private networking
Common Questions
Can I use a custom port for HTTPS?
Can I use a custom port for HTTPS?
No, HTTPS always uses port 443. You specify your container port (e.g., 3000), and Suga routes port 443 to your container port automatically.
Do I need to configure SSL certificates?
Do I need to configure SSL certificates?
No, Suga automatically provisions and renews certificates for all HTTPS endpoints. Traffic is encrypted end-to-end through Cloudflare’s CDN.
Can I expose a database publicly?
Can I expose a database publicly?
Yes, using TCP proxy. However, it’s not recommended for security reasons. Keep databases private and access them via your application or a bastion host.
Can services in different projects communicate?
Can services in different projects communicate?
Not via private networking. Use public networking (HTTPS/TCP) or deploy related services in the same project.
How do I restrict access to public endpoints?
How do I restrict access to public endpoints?
Currently, public endpoints are accessible by anyone. Implement authentication in your application. IP allowlisting is planned for a future release.