Skip to main content

vkdr nginx-gw

Use these commands to install and manage NGINX Gateway Fabric in your vkdr cluster.

NGINX Gateway Fabric is an implementation of the Kubernetes Gateway API using NGINX as the data plane. It provides a modern, standardized way to configure traffic routing in Kubernetes.

Gateway API vs Ingress

The Gateway API is the evolution of the Ingress API, offering:

  • Role-based configuration (infrastructure vs application teams)
  • More expressive routing rules
  • Better support for TCP/UDP traffic
  • Standardized API across implementations

vkdr nginx-gw install

Install NGINX Gateway Fabric in your cluster.

vkdr nginx-gw install [--node-ports=<node_ports>]

Flags

FlagDescriptionDefault
--node-portsNodePorts for http/https (e.g., 30000,30001 or *)(none)

What Gets Installed

  1. Control Plane (if not already installed):

    • Gateway API CRDs
    • NGINX Gateway Fabric controller
    • GatewayClass named nginx
  2. TLS Certificate (if not exists):

    • Self-signed certificate for TLS termination
    • SANs: localhost, *.localhost, localdomain, *.localdomain
    • Stored in secret nginx-gateway-tls
  3. Gateway (always created/updated):

    • Default Gateway named nginx in nginx-gateway namespace
    • HTTP listener on port 80
    • HTTPS listener on port 443 with TLS termination
    • Allows HTTPRoutes from all namespaces

Note: If the control plane is already installed, only the Gateway object is created. This allows multiple install calls to update the Gateway configuration without reinstalling the controller.

Examples

Basic Installation

vkdr infra up
vkdr nginx-gw install
# Access via http://localhost:8000 and https://localhost:8001

With Custom Ports

Start the cluster with custom HTTP/HTTPS ports:

vkdr infra start --http 80 --https 443
vkdr nginx-gw install
# Access via http://localhost and https://localhost

Using NodePorts

When using NodePort mode instead of LoadBalancer:

# Start cluster with nodeports
vkdr infra start --nodeports 2

# Install NGINX Gateway Fabric with NodePort
vkdr nginx-gw install --node-ports 30000,30001
# Or use '*' for defaults
vkdr nginx-gw install --node-ports '*'

# Access via http://localhost:9000 and https://localhost:9001

vkdr nginx-gw remove

Remove NGINX Gateway from your cluster.

vkdr nginx-gw remove [--delete-fabric]

Flags

FlagDescriptionDefault
--delete-fabric, --allAlso remove control plane and TLS secretfalse

What Gets Removed

Default behavior (no flags):

  • Removes the Gateway object named nginx
  • Removes any associated NginxProxy configuration
  • Keeps the control plane and TLS secret for quick re-creation of Gateways

With --delete-fabric or --all:

  • Removes the Gateway and NginxProxy (as above)
  • Uninstalls the NGINX Gateway Fabric helm release (control plane)
  • Deletes the entire nginx-gateway namespace (including TLS secret)
  • Gateway API CRDs remain installed
  • Idempotent: safe to run multiple times

Examples

# Remove Gateway only (fast, control plane stays)
vkdr nginx-gw remove

# Full removal including control plane and TLS secret
vkdr nginx-gw remove --delete-fabric
# or
vkdr nginx-gw remove --all

vkdr nginx-gw explain

Explain NGINX Gateway Fabric setup and configuration options.

vkdr nginx-gw explain

Using Gateway API Resources

Creating a Gateway

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
spec:
gatewayClassName: nginx
listeners:
- name: http
port: 80
protocol: HTTP

Creating an HTTPRoute

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: my-route
spec:
parentRefs:
- name: my-gateway
hostnames:
- "example.localhost"
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: my-service
port: 80

Complete Example

Quick Development Setup

# Start cluster
vkdr infra up

# Install NGINX Gateway Fabric
vkdr nginx-gw install

# Test with whoami using Gateway API
vkdr whoami install --gateway nginx
curl http://whoami.localhost:8000

# Clean up
vkdr whoami remove
vkdr nginx-gw remove
vkdr infra stop

NGINX Gateway Fabric vs NGINX Ingress Controller

FeatureGateway FabricIngress Controller
APIGateway APIIngress API
ConfigurationGateway/HTTPRoute CRDsIngress + Annotations
Role separationYes (Infra/App teams)Limited
TCP/UDPNative supportVia ConfigMap
Future-proofGateway API is the futureLegacy but stable

When to Use NGINX Gateway Fabric

  • New projects starting fresh
  • Need Gateway API features
  • Want role-based configuration
  • Planning for future Kubernetes standards

When to Use NGINX Ingress Controller

  • Existing projects using Ingress
  • Simple HTTP/HTTPS routing needs
  • Extensive existing documentation/examples