DNS & SSL Configuration
This section details the domain name registration and the multiple methods used to secure HTTP endpoints horizontally across the gcp-ecommerce-demo.com domain. Different workloads implemented in GCP (GKE, Cloud Run, and pure Compute Engine) each utilize different native Google Cloud patterns for managing and serving SSL/TLS certificates.
Domain Registration
The base domain, gcp-ecommerce-demo.com, was registered entirely via Google Cloud Domains. Note that while Cloud Domains facilitated the registration and provided a streamlined interface native to Google Cloud, the underlying authoritative registrar for the domain is Squarespace.
Registration via Cloud Domains automatically provisions a Google Cloud DNS managed zone (gcp-ecommerce-demo-com) and populates it with correct NS/SOA records. Our infrastructure uses Terraform (data "google_dns_managed_zone") to lookup this managed zone dynamically, avoiding Terraform applying conflicts and ensuring all automatically created registrar settings remain intact.
Application Load Balancing & SSL Provisioning
Securing an endpoint over HTTPS requires a Google-managed SSL certificate and a functioning L7 network layer (like a Global External HTTP(S) Load Balancer). Because our workloads span different GCP execution platforms, the specific implementation securing each layer varies:
1. Developer Portal (Cloud Run)
Endpoint: docs.gcp-ecommerce-demo.com
- Platform: Google Cloud Run.
- Mechanism: Cloud Run natively provisions its own managed certificates when a Custom Domain Mapping is created.
- Process: By defining a
google_cloud_run_domain_mappingin Terraform, Cloud Run is instructed to manage traffic for thedocssubdomain. Once the corresponding CNAME record (ghs.googlehosted.com.) is published in our DNS zone, Cloud Run transparently provisions and auto-renews a Google-managed certificate. No distinct load balancer or certificate resource needs to be orchestrated explicitly.
2. Online Boutique (Google Kubernetes Engine)
Endpoint: gcp-ecommerce-demo.com and www.gcp-ecommerce-demo.com
- Platform: GKE (Kubernetes).
- Mechanism: GKE
Gateway API(usinggke-l7-global-external-managedGatewayClass) coupled with Google CloudCertificate Manager. -
Process: Instead of using the legacy
Ingresscontroller, this demo utilizes the modern Kubernetes Gateway API to orchestrate a Global External Application Load Balancer:- Certificate Manager: Terraform provisions a
google_certificate_manager_certificateand a Certificate Map. This provides a robust, cluster-independent framework for managing SSL certificates, allowing the Gateway to seamlessly terminate TLS traffic. - Gateway Resource: A Kubernetes
Gatewayis deployed, binding the reserved static IP and the Certificate Map to both anhttp(Port 80) and anhttps(Port 443) listener. - HTTP-to-HTTPS Redirect: Securing the site forcefully is achieved by deploying two isolated
HTTPRouteresources:frontend-route: Attaches exclusively to thehttpslistener to route secure traffic to the application pods.frontend-redirect: Attaches exclusively to thehttplistener with aRequestRedirectfilter (statusCode: 301, scheme: https), automatically bouncing all unencrypted traffic.
Educational Note: When viewing this setup in the Google Cloud Console, you will see two Load Balancers listed for this Gateway. This is because Gateway API strictly isolates listeners, prompting Google Cloud to create dedicated Target Proxies and URL Maps for HTTP and HTTPS respectively. This is the intended architecture and does not incur double the base forwarding rule cost!
- Certificate Manager: Terraform provisions a
3. CRM Dashboard (Compute Engine)
Endpoint: crm.gcp-ecommerce-demo.com
- Platform: GCE (Compute VMs).
- Mechanism: External HTTP(S) Load Balancer provisioned purely via Terraform.
- Process: Since this dashboard runs entirely on native Compute Engine VMs, Terraform explicitly handles the architecture of an L7 Load Balancer.
- A
google_compute_managed_ssl_certificateacts as the certificate authority proxy. - The previous HTTP proxy is upgraded to a
google_compute_target_https_proxythat attaches the backend URL map and the Google-managed SSL certificate. - The
google_compute_global_forwarding_ruleis mapped to port443, directly utilizing thehttps_proxylayer to serve HTTPS traffic exclusively natively.
- A
4. CRM Status Page (Direct Compute Engine Binding)
Endpoint: status.crm.gcp-ecommerce-demo.com
- Platform: GCE (Direct IP Attachment).
- Mechanism: None (Raw HTTP).
- Process: The CRM Status Page points directly to a single VM's regional public external IP address, bypassing any Load Balancing mechanisms. Without an intermediate proxy edge (like an API Gateway or native Load Balancer), Google Cloud cannot automatically terminate an SSL/TLS managed certificate transparently. To secure this endpoint over HTTPS, TLS must be handled either by deploying an additional Cloud Load Balancer in front of it, or manually provisioning a certificate (e.g., Let's Encrypt Certbot) directly onto the VM OS. For demonstration utility, it remains raw HTTP.