Skip to content

Commit

Permalink
Adds gateway to expose internal services
Browse files Browse the repository at this point in the history
This patch adds the common gateway (flex-gateway) in nginx-gateway
namespace. This gateway will be shared by all other namespaces to
expose services internally. To do so the service that is getting
exposed internally simply need to follow the fqdn naming of
*.sjc.ohthree.com and ref the flex-gateway.

Also, adding the http routes for prometheus and alertmanager that
use the above method to expose the two services internally.
  • Loading branch information
sulochan committed Mar 22, 2024
1 parent 9013dab commit 2671878
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kustomize/gateway/alertmanager-routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: alertmanger-gateway-route
namespace: prometheus
spec:
parentRefs:
- name: flex-gateway
sectionName: http
namespace: nginx-gateway
hostnames:
- "alertmanager.sjc.ohthree.com"
rules:
- backendRefs:
- name: kube-prometheus-stack-alertmanager
port: 9093
15 changes: 15 additions & 0 deletions kustomize/gateway/internal-gateway-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: flex-gateway
namespace: nginx-gateway
spec:
gatewayClassName: nginx
listeners:
- name: http
port: 80
protocol: HTTP
hostname: "*.sjc.ohthree.com"
allowedRoutes:
namespaces:
from: All
4 changes: 4 additions & 0 deletions kustomize/gateway/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- internal-gateway-api.yaml # namespace: nginx-gateway (common gateway)
- alertmanager-routes.yaml # namespace: prometheus
- prometheus-routes.yaml # namespace: prometheus
16 changes: 16 additions & 0 deletions kustomize/gateway/prometheus-routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: prometheus-gateway-route
namespace: prometheus
spec:
parentRefs:
- name: flex-gateway
sectionName: http
namespace: nginx-gateway
hostnames:
- "prometheus.sjc.ohthree.com"
rules:
- backendRefs:
- name: kube-prometheus-stack-prometheus
port: 9090

0 comments on commit 2671878

Please sign in to comment.