ingress controller for frontend and rest api

This commit is contained in:
Roger 2024-04-21 01:24:28 +00:00
parent a986835e24
commit 5e7340c1fa
6 changed files with 36 additions and 33 deletions

View File

@ -48,6 +48,5 @@ spec:
- protocol: TCP - protocol: TCP
port: 8000 port: 8000
targetPort: 8000 targetPort: 8000
nodePort: 30003 type: ClusterIP
type: NodePort

View File

@ -16,7 +16,7 @@ spec:
spec: spec:
containers: containers:
- name: frontend - name: frontend
image: oktopusp/frontend:latest image: rogersacchelli/frontend:1.0.3
resources: resources:
requests: requests:
memory: 64Mi memory: 64Mi
@ -25,11 +25,11 @@ spec:
memory: 256Mi memory: 256Mi
cpu: 200m cpu: 200m
ports: ports:
- containerPort: 8080 - containerPort: 3000
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
# - name: NEXT_PUBLIC_REST_ENDPOINT - name: NEXT_PUBLIC_REST_ENDPOINT
# value: "192.168.1.130:30003" value: "/api"
#- name: NEXT_PUBLIC_WS_ENDPOINT #- name: NEXT_PUBLIC_WS_ENDPOINT
# value: "192.168.1.130:30005" # value: "192.168.1.130:30005"
--- ---
@ -42,7 +42,7 @@ spec:
app: frontend app: frontend
ports: ports:
- protocol: TCP - protocol: TCP
port: 8080 port: 3000
targetPort: 8080 targetPort: 3000
externalTrafficPolicy: Local #externalTrafficPolicy: Local
type: LoadBalancer type: ClusterIP

View File

@ -1,7 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-kubernetes-ingress
namespace: haproxy-controller
data:
syslog-server: "address:stdout, format: raw, facility:daemon"

View File

@ -1,8 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-tcp
namespace: default
data:
1883: # Port where the frontend is going to listen to.
default/mqtt-svc:1883 # Kubernetes service in the format NS/ServiceName:ServicePort

View File

@ -1,8 +0,0 @@
controller:
service:
tcpPorts:
- name: mqtt
port: 1883
targetPort: 1883
extraArgs:
- --configmap-tcp-services=default/haproxy-tcp

View File

@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-ingress
namespace: default
annotations:
spec:
ingressClassName: "haproxy"
rules:
- host: oktopus.rdss.cloud
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend-svc
port:
number: 3000
- path: /api
pathType: Prefix
backend:
service:
name: controller-svc
port:
number: 8000