Skip to content

Commit

Permalink
create apigateway using cluster IP chat health
Browse files Browse the repository at this point in the history
CharlyJazz committed Nov 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9f0346c commit ac3ff0a
Showing 9 changed files with 56 additions and 6 deletions.
2 changes: 2 additions & 0 deletions api-gateway/README.md
Original file line number Diff line number Diff line change
@@ -71,3 +71,5 @@ List the pods the load balancer pointing to.
Make sure that probes (ie. readiness, liveness) are configured.
Describe the pods ( kubectl describe pods <pod_name> -n <namespace>) to see why the health check is failing.
Fix the health check problem. Once the pods are healthy, give the load balancer some time (sometimes it takes hours) to update the status.

https://medium.com/google-developer-experts/getting-started-with-gke-gateway-controller-ee45c3bc8996
2 changes: 1 addition & 1 deletion api-gateway/auth-http-route.yaml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ metadata:
spec:
parentRefs:
- kind: Gateway
name: global-external-managed-chat-api-gateway
name: gke-l7-gxlb-api-gateway
rules:
- matches:
- path:
19 changes: 19 additions & 0 deletions api-gateway/chat-health-check-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.gke.io/v1
kind: HealthCheckPolicy
metadata:
name: chat-healthcheck
spec:
default:
checkIntervalSec: 10
timeoutSec: 10
logConfig:
enabled: true
config:
type: HTTP
httpHealthCheck:
port: 9000
requestPath: /api/health/
targetRef:
group: ""
kind: Service
name: chat-microservice-service
17 changes: 17 additions & 0 deletions api-gateway/chat-http-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: chat-http-route
spec:
parentRefs:
- kind: Gateway
name: gke-l7-gxlb-api-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /chat
backendRefs:
- kind: Service
name: chat-microservice-service
port: 9000
4 changes: 2 additions & 2 deletions api-gateway/gateway.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: global-external-managed-chat-api-gateway
name: gke-l7-gxlb-api-gateway
spec:
gatewayClassName: gke-l7-global-external-managed
gatewayClassName: gke-l7-gxlb # Probar este
listeners:
- name: http-listener
protocol: HTTP
2 changes: 1 addition & 1 deletion auth-microservice/k8s/auth-db-service.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ metadata:
name: auth-db-service
app: database
spec:
type: LoadBalancer
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
2 changes: 1 addition & 1 deletion chat-microservice/k8s/cassandra-service.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ metadata:
name: chat-db-service
app: database
spec:
type: LoadBalancer
type: ClusterIP
ports:
- port: 9042
targetPort: 9042
12 changes: 12 additions & 0 deletions chat-microservice/k8s/chat-microservice-deployment.yaml
Original file line number Diff line number Diff line change
@@ -18,6 +18,18 @@ spec:
- name: chat-microservice
image: charlyjazz/chat-microservice:latest
imagePullPolicy: Always
livenessProbe:
initialDelaySeconds: 60
httpGet:
path: /api/health/
scheme: HTTP
port: 9000
readinessProbe:
initialDelaySeconds: 60
httpGet:
path: /api/health/
scheme: HTTP
port: 9000
ports:
- containerPort: 9000
hostPort: 9000
2 changes: 1 addition & 1 deletion chat-microservice/k8s/chat-microservice-service.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ metadata:
name: chat-microservice-service
app: microservice
spec:
type: LoadBalancer
type: ClusterIP
ports:
- port: 9000
targetPort: 9000

0 comments on commit ac3ff0a

Please sign in to comment.