I have successfully setup GKE Cluster using GKE Ingress for both developer and production env in a different Project name through Github Action (CI/CD).
Explaining in details
1. And in 7 deployment im using for 7 all --> readinessProbe/livenessProbe/startupProbe, env variables, resources/requests/limits.
2. And in 7 service(svc) im using for 7 all --> type: ClusterIP
[enter image description here](https://i.stack.imgur.com/R2Jux.png)
3. And in 7 ingress im using for 7 all --> ingressClassName: "gce", kubernetes.io/ingress.global-static-ip-name, networking.gke.io/managed-certificates and comes to rules
- host: "ui.cloudnetwork.in"
- host: "backend.cloudnetwork.in"
- host: "backend-eng.cloudnetwork.in"
- host: "test-svc.cloudnetwork.in"
- host: "test-course.cloudnetwork.in"
- host: "test-contact.cloudnetwork.in"
- path: /* --> to all 7 i given same
backend:
service:
name: ui
port:
number: 8080
backend:
service:
name: backend
port:
number: 8080
backend:
service:
name: backend-eng
port:
number: 8080
backend:
service:
name: test-svc
port:
number: 8080
backend:
service:
name: test-course
port:
number: 3000
backend:
service:
name: test-contact
port:
number: 3000
Optional only for Ingress defaultBackend (I didn't use this just sharing whether to use this or not)
spec:
defaultBackend:
service:
name: ui
port:
number: 8080
Optional only for backendconfig (I didn't use this just sharing whether to use this or not)
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: ui
namespace: cloudnetwork
spec:
healthCheck:
timeoutSec: 1
type: HTTP
requestPath: /
port: 8080
Ingress also have 7 external/public IP address that mapped to above 7 domain name that register in godaddy in A records enter image description here ManagedCertificate 4. I used google managed certificate for 7 after 3 months it will expire but i don't know to whether it will renew automatically or manually i need to renew it that still i need look on it
- And also we are using 7 Health checks that connect to 7 services (svc) enter image description here
- And also we are using 3 Network endpoint group( Zonal NEGs) for each all 7 services (svc) that means 21 Zonal NEG total we using that ingress gke create that
its all running having 2 replicas for each deployment that mean total 14 pods are running.
My Question is can i use multiple ingress and multiple load balancer and multiple domain names i know cost will be high when we use multiple load balancer
I want to know do we have any alternate solution instead of using multiple load balancer, domain names and ingress
Only i need to ui domain name reset all 6 services can have service name or anything
why i used domain name is that because its ui service is talk to backend service and then backend talk to backend.eng service that one on one depends in-between we have DB also after backend service.
Sample for one ui.yaml sharing u and same i used for 6 service
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "ui"
namespace: "cloudnetwork"
labels:
app: "ui"
spec:
replicas: 2
selector:
matchLabels:
app: "ui"
template:
metadata:
labels:
app: "ui"
spec:
containers:
- name: "ui"
image: "xxxxxxxxxx:2024-02-22-1334"
imagePullPolicy: Always
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 30
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 30
periodSeconds: 5
startupProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 30
failureThreshold: 0
periodSeconds: 10
env:
- name: "BACKEND_URL"
value: "https://backend.cloudnetwork.in"
resources:
requests: # Minimum amount of resources requested
cpu: 200m
memory: 512M
limits: # Maximum amount of resources requested
cpu: 500m
memory: 1024M
---
apiVersion: v1
kind: Service
metadata:
name: ui
namespace: cloudnetwork
labels:
app: webui
spec:
type: ClusterIP
selector:
app: ui
ports:
- port: 8080
targetPort: 8080
protocol: TCP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-ui
namespace: cloudnetwork
annotations:
ingressClassName: "gce"
kubernetes.io/ingress.global-static-ip-name: ingress-ui
networking.gke.io/managed-certificates: managed-cert-ui
spec:
rules:
- host: "ui.cloudnetwork.in"
http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: ui
port:
number: 8080
---
This is option i didnt use but if need or this one is better then i will use it
# apiVersion: networking.k8s.io/v1
# kind: Ingress
# metadata:
# name: ingress-ui
# namespace: cloudnetwork
# annotations:
# kubernetes.io/ingress.global-static-ip-name: ingress-ui
# networking.gke.io/managed-certificates: managed-cert-ui
# ingressClassName: "gce"
# spec:
# defaultBackend:
# service:
# name: ui
# port:
# number: 8080
---
# apiVersion: networking.gke.io/v1
# kind: ManagedCertificate
# metadata:
# name: managed-cert-ui
# namespace: cloudnetwork
# spec:
# domains:
# - ui.cloudnetwork.in
---
This is option i didnt use but if need or this one is better then i will use it
# apiVersion: cloud.google.com/v1
# kind: BackendConfig
# metadata:
# name: ui
# namespace: cloudnetwork
# spec:
# healthCheck:
# timeoutSec: 1
# type: HTTP
# requestPath: /
# port: 8080
Above all i deploy in PROD env is up and running i dont want to take any risk on prod purpose and also want to save COST