Created
April 7, 2024 17:29
-
-
Save devops-school/c7c7af6529980d89c0aa0311cb39b340 to your computer and use it in GitHub Desktop.
Google Cloud: Step by Step Tutorials for setting up Multi-cluster Ingress (MCI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Application Deployment | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: my-app | |
namespace: default | |
spec: | |
selector: | |
matchLabels: | |
app: my-app | |
replicas: 2 | |
template: | |
metadata: | |
labels: | |
app: my-app | |
spec: | |
containers: | |
- name: nginx | |
image: nginx | |
ports: | |
- containerPort: 80 | |
# Service (ClusterIP) Exposing the Application | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: my-app-service | |
namespace: default | |
spec: | |
ports: | |
- port: 80 | |
targetPort: 80 | |
selector: | |
app: my-app | |
type: ClusterIP | |
# MultiClusterService Configuration | |
apiVersion: networking.gke.io/v1 | |
kind: MultiClusterService | |
metadata: | |
name: my-app-mcs | |
namespace: default | |
spec: | |
template: | |
spec: | |
selector: | |
app: my-app | |
ports: | |
- name: http | |
protocol: TCP | |
port: 80 | |
targetPort: 80 | |
# MultiClusterIngress Configuration | |
apiVersion: networking.gke.io/v1 | |
kind: MultiClusterIngress | |
metadata: | |
name: my-app-mci | |
namespace: default | |
spec: | |
template: | |
spec: | |
frontendConfig: | |
name: my-app-frontendconfig | |
rules: | |
- host: myapp.example.com | |
http: | |
paths: | |
- path: /* | |
pathType: Prefix | |
backend: | |
service: | |
name: my-app-mcs | |
port: | |
number: 80 | |
# FrontendConfig | |
apiVersion: networking.gke.io/v1 | |
kind: FrontendConfig | |
metadata: | |
name: my-app-frontendconfig | |
namespace: default | |
spec: | |
sslPolicy: custom-ssl-policy | |
redirectToHttps: | |
enabled: true | |
# BackendConfig | |
apiVersion: cloud.google.com/v1 | |
kind: BackendConfig | |
metadata: | |
name: my-app-backendconfig | |
namespace: default | |
spec: | |
healthCheck: | |
checkIntervalSec: 30 | |
timeoutSec: 5 | |
healthyThreshold: 2 | |
unhealthyThreshold: 3 | |
requestPath: /healthz | |
sessionAffinity: | |
affinityType: CLIENT_IP | |
`` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment