with kubernetes config files
This commit is contained in:
22
gateway/gateway.yaml
Normal file
22
gateway/gateway.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# kubernetes/gateway/gateway.yaml
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: GatewayClass
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
controllerName: gateway.nginx.org/nginx-gateway-controller
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: todo-gateway
|
||||
namespace: todo-app
|
||||
spec:
|
||||
gatewayClassName: nginx
|
||||
listeners:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: HTTP
|
||||
allowedRoutes:
|
||||
namespaces:
|
||||
from: Same # only routes from todo-app namespace
|
||||
27
gateway/httproute.yaml
Normal file
27
gateway/httproute.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
# kubernetes/gateway/httproute.yaml
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: todo-routes
|
||||
namespace: todo-app
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: todo-gateway
|
||||
rules:
|
||||
# API traffic → backend
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /api
|
||||
backendRefs:
|
||||
- name: backend-service
|
||||
port: 5000
|
||||
|
||||
# All other traffic → frontend
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
backendRefs:
|
||||
- name: frontend-service
|
||||
port: 30081
|
||||
Reference in New Issue
Block a user