<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abdalluh Mostafa on Medium]]></title>
        <description><![CDATA[Stories by Abdalluh Mostafa on Medium]]></description>
        <link>https://medium.com/@abdalluh.mostafa_12842?source=rss-67272920beaa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*g97-Tp8VqID_9RAR</url>
            <title>Stories by Abdalluh Mostafa on Medium</title>
            <link>https://medium.com/@abdalluh.mostafa_12842?source=rss-67272920beaa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 19:53:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abdalluh.mostafa_12842/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[No JSON Keys Required: Secure GKE Workloads on GCP with Workload Identity Federation]]></title>
            <link>https://medium.com/@abdalluh.mostafa_12842/no-json-keys-required-secure-gke-workloads-on-gcp-with-workload-identity-federation-67ead7884140?source=rss-67272920beaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/67ead7884140</guid>
            <category><![CDATA[gke-workload-identity]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[keyless]]></category>
            <category><![CDATA[gke]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Abdalluh Mostafa]]></dc:creator>
            <pubDate>Fri, 26 Dec 2025 16:49:43 GMT</pubDate>
            <atom:updated>2025-12-26T16:52:01.395Z</atom:updated>
            <content:encoded><![CDATA[<p>If you run applications on <strong>Google Kubernetes Engine (GKE)</strong>, chances are they need to access other Google Cloud services <strong>Secret Manager, Cloud Storage, and Pub/Sub.</strong></p><p>For years, the common approach looked like this:</p><ul><li>Create a GCP Service Account</li><li>Generate a JSON key</li><li>Store it as a Kubernetes Secret</li><li>Mount it into the pod</li><li>Set GOOGLE_APPLICATION_CREDENTIALS</li></ul><p>It works! But it never <em>felt</em> right.</p><p>Static keys don’t expire, are hard to rotate, and once leaked, the blast radius can be massive. In modern cloud-native environments, this approach is simply outdated.</p><p>There’s a better way: <strong>keyless, native, and more secure (Workload Identity Federation).</strong></p><h4>The Problem with Service Account Keys</h4><p>A Service Account key is effectively a <strong>long-lived password</strong>:</p><ul><li>No automatic expiration</li><li>Easy to copy or leak</li><li>Operationally painful to rotate</li><li>Difficult to audit at scale</li></ul><p>In a microservices-heavy production cluster, this becomes a serious security liability.</p><h4>The Keyless Alternative: Workload Identity Federation</h4><p>Workload Identity Federation allows a <strong>GKE workload</strong> to impersonate a <strong>GCP Service Account</strong> without ever creating or storing a key.</p><p>Instead of credentials, GCP trusts the <strong>identity of the pod itself</strong>.</p><h4>Think of it this way:</h4><ul><li><strong>Old model</strong>: Give your app a permanent master key</li><li><strong>New model</strong>: The pod proves who it is, gets a short-lived access badge, and that’s it</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyreM6SuQYLfc8Lgsyg8TQ.jpeg" /></figure><p>Authentication is based on <strong>OIDC (OpenID Connect)</strong> and <strong>short-lived tokens</strong>, issued on demand.</p><p>No secrets. No files. No rotation headaches.</p><h4>Why this is the recommended approach?</h4><ul><li><strong>Much stronger security posture</strong></li><li><strong>Zero key management</strong></li><li><strong>Fine-grained access per workload</strong></li><li><strong>Works transparently with GCP client libraries</strong></li><li><strong>Official Google best practice for GKE</strong></li></ul><h3>Step-by-Step: GKE Accessing GCP</h3><h4>1. Enable Workload Identity on the Cluster</h4><pre>gcloud container clusters update CLUSTER_NAME \<br>  --region=us-central1 \<br>  --workload-pool=PROJECT_ID.svc.id.goog</pre><p>This configures:</p><ul><li>An OIDC issuer for the cluster</li><li>A managed Workload Identity Pool (no manual setup required)</li></ul><h4>2. Create a GCP Service Account</h4><pre>gcloud iam service-accounts create gke-workload-sa \<br>  --display-name=&quot;GKE Workload Service Account&quot;</pre><p>Grant only the permissions your app actually needs:</p><pre>gcloud projects add-iam-policy-binding PROJECT_ID \<br>  --member=&quot;serviceAccount:gke-workload-sa@PROJECT_ID.iam.gserviceaccount.com&quot; \<br>  --role=&quot;roles/storage.objectViewer&quot;</pre><h4>3. Allow the Kubernetes SA to Impersonate It</h4><pre>gcloud iam service-accounts add-iam-policy-binding \<br>  gke-workload-sa@PROJECT_ID.iam.gserviceaccount.com \<br>  --role=&quot;roles/iam.workloadIdentityUser&quot; \<br>  --member=&quot;serviceAccount:PROJECT_ID.svc.id.goog[default/my-app-sa]&quot;</pre><p>This explicitly says:</p><blockquote>Pods running use kubernates service account my-app-sa in the default namespace are trusted.</blockquote><h4>4. Annotate the Kubernetes Service Account</h4><pre>apiVersion: v1<br>kind: ServiceAccount<br>metadata:<br>  name: my-app-sa<br>  namespace: default<br>  annotations:<br>    iam.gke.io/gcp-service-account: gke-workload-sa@PROJECT_ID.iam.gserviceaccount.com</pre><p>Reference it in your Pod or Deployment:</p><pre>spec:<br>  serviceAccountName: my-app-sa</pre><p>That’s it.<br> No environment variables. No JSON keys. No secrets.</p><h3>What Happens at Runtime?</h3><ol><li>The pod starts using the annotated Kubernetes Service Account</li><li>GKE issues a verifiable identity token</li><li>GCP IAM validates the trust relationship</li><li>A short-lived access token is minted</li><li>Your app accesses GCP services securely</li></ol><p>All of this is <strong>automatic</strong> when using standard Google Cloud client libraries.</p><h3>Final Thoughts</h3><p>Workload Identity Federation isn’t just a security improvement, it’s a <strong>modern authentication model built for Kubernetes</strong>.</p><p>If your GKE workloads are still relying on Service Account keys, you’re carrying unnecessary risk.</p><p>Go keyless.<br> Your security team and your future self will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67ead7884140" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Access GCP resources from AWS EKS using workload identity federation without service account keys]]></title>
            <link>https://medium.com/@abdalluh.mostafa_12842/access-gcp-resources-from-aws-eks-using-workload-identity-federation-without-service-account-keys-3e9c0ff354ae?source=rss-67272920beaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e9c0ff354ae</guid>
            <category><![CDATA[ami]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[ek]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[workload-identity]]></category>
            <dc:creator><![CDATA[Abdalluh Mostafa]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 14:53:22 GMT</pubDate>
            <atom:updated>2026-01-01T12:59:58.882Z</atom:updated>
            <content:encoded><![CDATA[<h3>Secure Cross-Cloud Authentication Without Service Account Keys</h3><p><strong>By Abdallah Mostafa</strong></p><p>Running workloads across multiple cloud providers is no longer unusual.<br>Many teams today deploy applications on <strong>AWS EKS</strong>, while still depending on <strong>GCP services</strong> such as:</p><ul><li>Google Cloud Storage (GCS)</li><li>Pub/Sub</li><li>BigQuery</li><li>Secret Manager</li></ul><p>The challenge is not networking, it’s <strong>authentication</strong>.</p><blockquote><em>How can AWS workloads securely access GCP resources </em><strong><em>without</em></strong><em> storing GCP service account keys?</em></blockquote><p>This article demonstrates a <strong>production-ready approach</strong> using <strong>Workload Identity Federation (WIF)</strong>, allowing EKS pods to authenticate to GCP securely using <strong>short-lived credentials</strong> and <strong>zero secrets</strong>.</p><h3>The Problem 🚨</h3><p>The most common approach looks like this:</p><ol><li>Create a GCP service account</li><li>Download a JSON key</li><li>Store it as a Kubernetes Secret</li><li>Mount it into pods</li></ol><p>This creates serious risks:</p><ul><li>❌ Long-lived credentials</li><li>❌ Manual rotation</li><li>❌ Easy to leak</li><li>❌ Large blast radius</li><li>❌ Poor auditability</li></ul><p>Once that key leaks, <strong>anyone can impersonate your GCP service account</strong>.</p><h3>Solution: Use Workload Identity Federation</h3><p><strong>Workload Identity Federation</strong> allows workloads running outside GCP (AWS, Azure, on-prem) to authenticate using their <strong>native identity</strong>.</p><p>In this setup:</p><ul><li>EKS pods use <strong>Kubernetes Service Account tokens</strong></li><li>GCP trusts the <strong>EKS OIDC issuer</strong></li><li>Tokens are exchanged via <strong>STS</strong></li><li>GCP issues <strong>short-lived access tokens</strong></li><li>No JSON keys are created or stored</li></ul><h3>High-Level Architecture 🧠</h3><pre>EKS Pod<br>  |<br>  | (Kubernetes Service Account OIDC Token)<br>  v<br>GCP Workload Identity Provider<br>  |<br>  | (STS Token Exchange)<br>  v<br>GCP Service Account<br>  |<br>  v<br>GCP Resources (GCS, Pub/Sub, BigQuery)</pre><h3>Key Components 🧩</h3><ul><li><strong>Workload Identity Pool</strong><br> Groups external identities (AWS EKS)</li><li><strong>Workload Identity Provider</strong><br> Defines trust with the EKS OIDC issuer</li><li><strong>GCP Service Account</strong><br> The identity used to access GCP resources</li><li><strong>Kubernetes Service Account (EKS)</strong><br> Assigned to pods and mapped to GCP permissions</li></ul><h3>Prerequisites 📋</h3><h3>Tools</h3><ul><li>gcloud</li><li>kubectl</li><li>aws</li></ul><h3>Permissions</h3><ul><li>GCP Project Owner or IAM Admin</li><li>EKS cluster admin access</li></ul><h3>Required Information</h3><ul><li>GCP Project ID</li><li>GCP Project Number</li><li>AWS Region</li><li>EKS Cluster Name</li><li>EKS OIDC Issuer URL</li></ul><h3>Step 1: Gather Required Information</h3><pre># GCP<br>export PROJECT_ID=&quot;demo-gcp-project&quot;<br>export PROJECT_NUMBER=&quot;123456789012&quot;<br><br># AWS / EKS<br>export AWS_REGION=&quot;us-east-1&quot;<br>export CLUSTER_NAME=&quot;demo-eks-cluster&quot;</pre><h3>How to Get the EKS OIDC Issuer (OIDC_ID)</h3><p>Each EKS cluster exposes an OIDC issuer.</p><p>Run:</p><pre>aws eks describe-cluster \<br>  --name $CLUSTER_NAME \<br>  --region $AWS_REGION \<br>  --query &quot;cluster.identity.oidc.issuer&quot; \<br>  --output text</pre><p>Example output:</p><pre>https://oidc.eks.us-east-1.amazonaws.com/id/EXAMPLEOIDCID123456</pre><p>Save it:</p><pre>export OIDC_ISSUER_URL=&quot;https://oidc.eks.us-east-1.amazonaws.com/id/EXAMPLEOIDCID123456&quot;</pre><h3>Step 2: Define Resource Names</h3><pre>export WORKLOAD_IDENTITY_POOL_ID=&quot;aws-eks-pool&quot;<br>export WORKLOAD_IDENTITY_PROVIDER_ID=&quot;aws-eks-provider&quot;<br>export GCP_SERVICE_ACCOUNT_NAME=&quot;eks-workload-sa&quot;<br>export KUBERNETES_NAMESPACE=&quot;default&quot;<br>export KUBERNETES_SERVICE_ACCOUNT=&quot;gcp-ksa&quot;</pre><h3>Step 3: Enable Required GCP APIs</h3><pre>gcloud services enable iamcredentials.googleapis.com<br>gcloud services enable sts.googleapis.com<br>gcloud services enable cloudresourcemanager.googleapis.com</pre><h3>Step 4: Create Workload Identity Pool</h3><pre>gcloud iam workload-identity-pools create $WORKLOAD_IDENTITY_POOL_ID \<br>  --location=&quot;global&quot; \<br>  --display-name=&quot;AWS EKS Workload Identity Pool&quot;</pre><h3>Step 5: Create Workload Identity Provider</h3><pre>gcloud iam workload-identity-pools providers create-oidc \<br>  $WORKLOAD_IDENTITY_PROVIDER_ID \<br>  --location=&quot;global&quot; \<br>  --workload-identity-pool=&quot;$WORKLOAD_IDENTITY_POOL_ID&quot; \<br>  --issuer-uri=&quot;$OIDC_ISSUER_URL&quot; \<br>  --attribute-mapping=&quot;<br>    google.subject=assertion.sub,<br>    attribute.namespace=assertion[&#39;kubernetes.io&#39;][&#39;namespace&#39;],<br>    attribute.service_account=assertion[&#39;kubernetes.io&#39;][&#39;serviceaccount&#39;][&#39;name&#39;]<br>  &quot;</pre><p>This mapping allows <strong>fine-grained IAM control</strong> at namespace and service account level.</p><h3>Step 6: Create GCP Service Account</h3><pre>gcloud iam service-accounts create $GCP_SERVICE_ACCOUNT_NAME \<br>  --display-name=&quot;EKS Workload Identity Service Account&quot;</pre><h3>Step 7: Grant GCP Permissions</h3><p>Example: read access to GCS.</p><pre>gcloud projects add-iam-policy-binding $PROJECT_ID \<br>  --member=&quot;serviceAccount:$GCP_SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com&quot; \<br>  --role=&quot;roles/storage.objectViewer&quot;</pre><h3>Step 8: Allow Service Account Impersonation</h3><p>This step defines <strong>who is allowed to impersonate the GCP Service Account</strong> via Workload Identity Federation.<br> Choosing the right option here is critical for security.</p><h4>Option 1: Combined Namespace + Service Account (Most Secure)</h4><p>This is the <strong>most restrictive and recommended</strong> option for production environments.<br>It ensures that <strong>only one specific Kubernetes Service Account in one specific namespace </strong>can impersonate the GCP Service Account.</p><pre>gcloud iam service-accounts add-iam-policy-binding \<br>  $GCP_SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \<br>  --member=&quot;principal://iam.googleapis.com/projects/$PROJECT_NUMBER/locations/global/workloadIdentityPools/$WORKLOAD_IDENTITY_POOL_ID/subject/system:serviceaccount:$KUBERNETES_NAMESPACE:$KUBERNETES_SERVICE_ACCOUNT&quot; \<br>  --role=&quot;roles/iam.workloadIdentityUser&quot;</pre><p>🔐 <strong>Security guarantees:</strong></p><ul><li>Bound to a single namespace</li><li>Bound to a single Kubernetes Service Account</li><li>No other pod can impersonate this GCP Service Account</li></ul><p>✔ Best choice for production<br> ✔ Least blast radius</p><h4>Option 2: Namespace Only</h4><p>This option allows <strong>any pod running in a specific Kubernetes namespace</strong><br> to impersonate the GCP Service Account <strong>without binding to a specific KSA</strong>.</p><pre>gcloud iam service-accounts add-iam-policy-binding \<br>  $GCP_SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \<br>  --member=&quot;principalSet://iam.googleapis.com/projects/$PROJECT_NUMBER/locations/global/workloadIdentityPools/$WORKLOAD_IDENTITY_POOL_ID/attribute.namespace/$KUBERNETES_NAMESPACE&quot; \<br>  --role=&quot;roles/iam.workloadIdentityUser&quot;</pre><p>🔓 <strong>Behavior:</strong></p><ul><li>All service accounts inside the namespace are trusted</li><li>Simpler configuration</li><li>Useful for demos, POCs, or shared workloads</li></ul><p>⚠️ <strong>Security note:</strong><br> This is less restrictive than Option 1 and should be avoided in high-security production environments.</p><h3>Step 9: Create Kubernetes Service Account</h3><pre>kubectl create serviceaccount $KUBERNETES_SERVICE_ACCOUNT \<br>  -n $KUBERNETES_NAMESPACE</pre><h3>Step 10: Generate Credential Configuration</h3><pre>gcloud iam workload-identity-pools create-cred-config \<br>  projects/$PROJECT_NUMBER/locations/global/workloadIdentityPools/$WORKLOAD_IDENTITY_POOL_ID/providers/$WORKLOAD_IDENTITY_PROVIDER_ID \<br>  --service-account=$GCP_SERVICE_ACCOUNT_NAME@$PROJECT_ID.iam.gserviceaccount.com \<br>  --credential-source-file=/var/run/service-account/token \<br>  --output-file=credential-configuration.json</pre><p>⚠️ This file contains <strong>no secrets</strong>.</p><h3>Step 11: Create ConfigMap</h3><pre>kubectl create configmap gcp-wif-config \<br>  --from-file credential-configuration.json \<br>  -n $KUBERNETES_NAMESPACE</pre><h3>⚠️ Important Note About the audience Field</h3><p>In the pod spec, you will see:</p><pre>audience: https://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID</pre><p>🚨 <strong>This is a placeholder and must be replaced</strong> using the values defined earlier.</p><p>From:</p><pre>PROJECT_NUMBER=123456789012<br>WORKLOAD_IDENTITY_POOL_ID=aws-eks-pool<br>WORKLOAD_IDENTITY_PROVIDER_ID=aws-eks-provider</pre><p>Final value:</p><pre>https://iam.googleapis.com/projects/123456789012/locations/global/workloadIdentityPools/aws-eks-pool/providers/aws-eks-provider</pre><p>If this value does not match <strong>exactly</strong>, authentication will fail.</p><h3>Test Pod (YAML) 🧪</h3><p>Use this pod to validate authentication:</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: gcp-wif-test<br>  namespace: default<br>spec:<br>  serviceAccountName: gcp-ksa<br>  containers:<br>  - name: test<br>    image: google/cloud-sdk:alpine<br>    command: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;gcloud auth list &amp;&amp; gsutil ls &amp;&amp; sleep 3600&quot;]<br>    env:<br>    - name: GOOGLE_APPLICATION_CREDENTIALS<br>      value: /etc/workload-identity/credential-configuration.json<br>    volumeMounts:<br>    - name: token<br>      mountPath: /var/run/service-account<br>      readOnly: true<br>    - name: wif-config<br>      mountPath: /etc/workload-identity<br>      readOnly: true<br>  volumes:<br>  - name: token<br>    projected:<br>      sources:<br>      - serviceAccountToken:<br>          audience: https://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID<br>          expirationSeconds: 3600<br>          path: token<br>  - name: wif-config<br>    configMap:<br>      name: gcp-wif-config</pre><p>Test it:</p><pre>kubectl apply -f pod.yaml<br>kubectl exec gcp-wif-test -- gcloud auth list</pre><h3>Why This Matters 🚀</h3><ul><li>🔐 No service account keys</li><li>🔄 Short-lived credentials</li><li>🧠 Fine-grained IAM control</li><li>📉 Smaller blast radius</li><li>🌍 Production-ready multi-cloud security</li></ul><h3>Final Thoughts</h3><p>If you are running <strong>AWS EKS + GCP</strong> and still managing JSON keys,<br> Workload Identity Federation removes an entire class of security risks.</p><p>Once configured, authentication becomes <strong>invisible</strong>, <strong>secure</strong>, and <strong>fully automated</strong> exactly how it should be.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e9c0ff354ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From $400 to $25/Month: My Journey to Single Load Balancer Architecture in GKE]]></title>
            <link>https://medium.com/@abdalluh.mostafa_12842/from-400-to-25-month-my-journey-to-single-load-balancer-architecture-in-gke-c26b35685d9a?source=rss-67272920beaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c26b35685d9a</guid>
            <dc:creator><![CDATA[Abdalluh Mostafa]]></dc:creator>
            <pubDate>Thu, 18 Dec 2025 13:22:13 GMT</pubDate>
            <atom:updated>2025-12-18T13:22:13.483Z</atom:updated>
            <content:encoded><![CDATA[<p>A few months ago, I wrote about <a href="https://medium.com/@abdalluh.mostafa_12842/from-500-to-20-month-my-journey-to-single-alb-architecture-in-eks-0d05e1d6a6b9">how we reduced our AWS load balancer costs from $500 to $20/month</a> by moving to a single ALB architecture in EKS. That solution worked beautifully for our AWS workloads.</p><p>Then came the migration. Our team decided to move several services to GCP and GKE. I thought, “Great! I already solved this problem. It should be straightforward to implement the same architecture here.”</p><p>I was in for a surprise.</p><p>When I reviewed our initial GCP bill, I saw the same pattern repeating: 18 different Load Balancers, each microservice with its own Load Balancer. We were paying over $400 monthly just on load balancing, and we were planning to scale to 40+ services.</p><p>The math was painful again. But this time, I knew there had to be a solution. I just needed to figure out how to do it the GCP way.</p><p>After some investigation, I found the solution: one shared Load Balancer with multiple backends, each pointing to Network Endpoint Groups (NEGs) managed by GKE. The best part? We could manage the Load Balancer and backends with Terraform while application teams handled their BackendConfigs through Helm charts.</p><h3>The Architecture That Changed Everything</h3><p>Here’s what makes this approach powerful:</p><p><strong>Platform Team Responsibilities:</strong></p><ul><li>One shared Load Balancer (managed via Terraform)</li><li>Backend Services with NEG target type (managed via Terraform)</li><li>Health checks configuration (managed via Terraform)</li><li>URL maps and routing rules (managed via Terraform)</li></ul><p><strong>Application Team Responsibilities:</strong></p><ul><li>BackendConfig resources (via Helm charts)</li><li>Service annotations to create NEGs (via Helm charts)</li><li>Application-specific health check parameters (via Helm charts)</li></ul><p><strong>The Result:</strong> One Load Balancer (~$20/month) instead of 18+ Load Balancers ($400+/month).</p><p><strong>Bonus:</strong> This architecture works across multiple GKE clusters too! You can have services running in different clusters, all sharing the same Load Balancer. The NEGs simply point to pods in their respective clusters, and the Load Balancer routes traffic based on your URL map configuration.</p><h3>How Traffic Flows Through the Architecture</h3><p>Before we dive into implementation, let’s visualize how a request travels through our system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*-fQUyGfZerKa2JNOGQsC8Q.png" /></figure><p><strong>Key Points:</strong></p><ol><li><strong>Load Balancer</strong>: Single entry point, one external IP</li><li><strong>URL Map</strong>: Routes based on path (/v1, /v2) or host (v1.example.com)</li><li><strong>Backend Services</strong>: Each service has its own backend with health checks</li><li><strong>NEGs</strong>: Automatically created by GKE when you add the annotation</li><li><strong>Direct to Pods</strong>: Traffic goes straight to pod IPs, bypassing kube-proxy</li><li><strong>Multi-Cluster Ready</strong>: NEGs from different clusters can share the same Load Balancer</li></ol><h3>What We’ll Build</h3><p>In this complete guide, you’ll learn how to:</p><ol><li>Set up a GKE cluster with proper networking</li><li>Create a shared Load Balancer using Terraform</li><li>Configure backend services pointing to NEGs</li><li>Deploy applications with proper annotations</li><li>Use BackendConfig to customize behavior</li><li>Test the complete setup with two demo applications</li></ol><p>By the end, you’ll have a production-ready architecture that scales to dozens of services without multiplying costs.</p><h3>Prerequisites</h3><p>Before we start, make sure you have:</p><ul><li>A GCP project with billing enabled</li><li>gcloud CLI installed and configured</li><li>kubectl installed</li><li>helm installed</li><li>Terraform installed (version 1.0+)</li><li>Basic understanding of Kubernetes concepts</li></ul><h3>Environment Setup</h3><p>Let’s set our environment variables that we’ll use throughout:</p><pre>export PROJECT_ID=&quot;your-gcp-project-id&quot;<br>export REGION=&quot;us-central1&quot;<br>export CLUSTER_NAME=&quot;shared-lb-cluster&quot;<br>export NETWORK_NAME=&quot;gke-network&quot;</pre><p>Replace your-gcp-project-id with your actual project ID.</p><h3>Part 1: Creating the GKE Cluster</h3><p>First, we need a GKE cluster with proper networking configuration.</p><h3>Create VPC Network</h3><pre>gcloud compute networks create ${NETWORK_NAME} \<br>    --subnet-mode=custom \<br>    --project=${PROJECT_ID}</pre><pre>gcloud compute networks subnets create ${NETWORK_NAME}-subnet \<br>    --network=${NETWORK_NAME} \<br>    --region=${REGION} \<br>    --range=10.0.0.0/24 \<br>    --secondary-range pods=10.4.0.0/14 \<br>    --secondary-range services=10.8.0.0/20 \<br>    --project=${PROJECT_ID}</pre><h3>Create GKE Cluster</h3><pre>gcloud container clusters create ${CLUSTER_NAME} \<br>    --region=${REGION} \<br>    --network=${NETWORK_NAME} \<br>    --subnetwork=${NETWORK_NAME}-subnet \<br>    --cluster-secondary-range-name=pods \<br>    --services-secondary-range-name=services \<br>    --enable-ip-alias \<br>    --num-nodes=2 \<br>    --machine-type=e2-medium \<br>    --project=${PROJECT_ID}</pre><h3>Configure kubectl</h3><pre>gcloud container clusters get-credentials ${CLUSTER_NAME} \<br>    --region=${REGION} \<br>    --project=${PROJECT_ID}</pre><pre># Verify connection<br>kubectl get nodes</pre><h3>Part 2: Deploy Demo Applications</h3><p>Let’s create two simple applications that we’ll expose through our shared Load Balancer.</p><h3>Application V1</h3><p>Create k8s/app-v1.yaml:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: demo-app-v1<br>  namespace: default<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: demo-app-v1<br>  template:<br>    metadata:<br>      labels:<br>        app: demo-app-v1<br>    spec:<br>      containers:<br>      - name: app<br>        image: hashicorp/http-echo<br>        args:<br>          - &quot;-text=Hello from Demo App V1&quot;<br>          - &quot;-listen=:8080&quot;<br>        ports:<br>        - containerPort: 8080<br>        resources:<br>          requests:<br>            memory: &quot;64Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;200m&quot;<br>        livenessProbe:<br>          httpGet:<br>            path: /<br>            port: 8080<br>          initialDelaySeconds: 10<br>          periodSeconds: 5<br>        readinessProbe:<br>          httpGet:<br>            path: /<br>            port: 8080<br>          initialDelaySeconds: 5<br>          periodSeconds: 3</pre><h3>Application V2</h3><p>Create k8s/app-v2.yaml:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: demo-app-v2<br>  namespace: default<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: demo-app-v2<br>  template:<br>    metadata:<br>      labels:<br>        app: demo-app-v2<br>    spec:<br>      containers:<br>      - name: app<br>        image: hashicorp/http-echo<br>        args:<br>          - &quot;-text=Hello from Demo App V2&quot;<br>          - &quot;-listen=:8080&quot;<br>        ports:<br>        - containerPort: 8080<br>        resources:<br>          requests:<br>            memory: &quot;64Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;200m&quot;<br>        livenessProbe:<br>          httpGet:<br>            path: /<br>            port: 8080<br>          initialDelaySeconds: 10<br>          periodSeconds: 5<br>        readinessProbe:<br>          httpGet:<br>            path: /<br>            port: 8080<br>          initialDelaySeconds: 5<br>          periodSeconds: 3</pre><h3>Deploy Applications</h3><pre>kubectl apply -f k8s/app-v1.yaml<br>kubectl apply -f k8s/app-v2.yaml</pre><pre># Verify deployments<br>kubectl get deployments<br>kubectl get pods</pre><h3>Part 3: Create Services with NEG Annotations</h3><p>This is where the magic happens. We’ll create ClusterIP services with special annotations that tell GKE to create Network Endpoint Groups automatically.</p><h3>Service for V1</h3><p>Create k8s/service-v1.yaml:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: demo-app-v1<br>  namespace: default<br>  annotations:<br>    cloud.google.com/backend-config: &#39;{&quot;default&quot;: &quot;demo-app-v1-backend-config&quot;}&#39;<br>    cloud.google.com/neg: &#39;{&quot;exposed_ports&quot;: {&quot;8080&quot;:{&quot;name&quot;: &quot;demo-app-v1-neg&quot;}}}&#39;<br>spec:<br>  type: ClusterIP<br>  selector:<br>    app: demo-app-v1<br>  ports:<br>  - port: 8080<br>    targetPort: 8080<br>    protocol: TCP<br>    name: http<br>---<br>apiVersion: cloud.google.com/v1<br>kind: BackendConfig<br>metadata:<br>  name: demo-app-v1-backend-config<br>  namespace: default<br>spec:<br>  healthCheck:<br>    port: 8080<br>    requestPath: /<br>    type: HTTP<br>    checkIntervalSec: 10<br>    timeoutSec: 5<br>    healthyThreshold: 2<br>    unhealthyThreshold: 3<br>  timeoutSec: 30<br>  connectionDraining:<br>    drainingTimeoutSec: 60</pre><h3>Service for V2</h3><p>Create k8s/service-v2.yaml:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: demo-app-v2<br>  namespace: default<br>  annotations:<br>    cloud.google.com/backend-config: &#39;{&quot;default&quot;: &quot;demo-app-v2-backend-config&quot;}&#39;<br>    cloud.google.com/neg: &#39;{&quot;exposed_ports&quot;: {&quot;8080&quot;:{&quot;name&quot;: &quot;demo-app-v2-neg&quot;}}}&#39;<br>spec:<br>  type: ClusterIP<br>  selector:<br>    app: demo-app-v2<br>  ports:<br>  - port: 8080<br>    targetPort: 8080<br>    protocol: TCP<br>    name: http<br>---<br>apiVersion: cloud.google.com/v1<br>kind: BackendConfig<br>metadata:<br>  name: demo-app-v2-backend-config<br>  namespace: default<br>spec:<br>  healthCheck:<br>    port: 8080<br>    requestPath: /<br>    type: HTTP<br>    checkIntervalSec: 10<br>    timeoutSec: 5<br>    healthyThreshold: 2<br>    unhealthyThreshold: 3<br>  timeoutSec: 30<br>  connectionDraining:<br>    drainingTimeoutSec: 60</pre><h3>Apply Services</h3><pre>kubectl apply -f k8s/service-v1.yaml<br>kubectl apply -f k8s/service-v2.yaml</pre><pre># Verify services<br>kubectl get services<br>kubectl get backendconfigs</pre><h3>Verify NEG Creation</h3><p>Wait a minute for GKE to create the NEGs, then verify:</p><pre>gcloud compute network-endpoint-groups list \<br>    --project=${PROJECT_ID} \<br>    --filter=&quot;name~demo-app&quot;</pre><p>You should see two NEGs created automatically:</p><ul><li>demo-app-v1-neg</li><li>demo-app-v2-neg</li></ul><h3>Part 4: Create Load Balancer with Terraform</h3><p>Now comes the infrastructure as code part. We’ll create the Load Balancer, backend services, and routing rules using Terraform.</p><h3>Terraform Configuration</h3><p>Create terraform/main.tf:</p><pre>terraform {<br>  required_version = &quot;&gt;= 1.0&quot;<br>  required_providers {<br>    google = {<br>      source  = &quot;hashicorp/google&quot;<br>      version = &quot;~&gt; 5.0&quot;<br>    }<br>  }<br>}</pre><pre>provider &quot;google&quot; {<br>  project = var.project_id<br>  region  = var.region<br>}</pre><pre>variable &quot;project_id&quot; {<br>  description = &quot;GCP Project ID&quot;<br>  type        = string<br>}</pre><pre>variable &quot;region&quot; {<br>  description = &quot;GCP Region&quot;<br>  type        = string<br>  default     = &quot;us-central1&quot;<br>}</pre><pre># Data source to get the NEGs created by GKE<br>data &quot;google_compute_network_endpoint_group&quot; &quot;v1&quot; {<br>  name = &quot;demo-app-v1-neg&quot;<br>  zone = &quot;${var.region}-a&quot;<br>}</pre><pre>data &quot;google_compute_network_endpoint_group&quot; &quot;v2&quot; {<br>  name = &quot;demo-app-v2-neg&quot;<br>  zone = &quot;${var.region}-a&quot;<br>}</pre><pre># Health Check for V1<br>resource &quot;google_compute_health_check&quot; &quot;v1&quot; {<br>  name                = &quot;demo-app-v1-health-check&quot;<br>  check_interval_sec  = 10<br>  timeout_sec         = 5<br>  healthy_threshold   = 2<br>  unhealthy_threshold = 3</pre><pre>  http_health_check {<br>    port         = 8080<br>    request_path = &quot;/&quot;<br>  }<br>}</pre><pre># Health Check for V2<br>resource &quot;google_compute_health_check&quot; &quot;v2&quot; {<br>  name                = &quot;demo-app-v2-health-check&quot;<br>  check_interval_sec  = 10<br>  timeout_sec         = 5<br>  healthy_threshold   = 2<br>  unhealthy_threshold = 3</pre><pre>  http_health_check {<br>    port         = 8080<br>    request_path = &quot;/&quot;<br>  }<br>}</pre><pre># Backend Service for V1<br>resource &quot;google_compute_backend_service&quot; &quot;v1&quot; {<br>  name                  = &quot;demo-app-v1-backend&quot;<br>  protocol              = &quot;HTTP&quot;<br>  port_name             = &quot;http&quot;<br>  timeout_sec           = 30<br>  health_checks         = [google_compute_health_check.v1.id]<br>  load_balancing_scheme = &quot;EXTERNAL_MANAGED&quot;</pre><pre>  backend {<br>    group           = data.google_compute_network_endpoint_group.v1.id<br>    balancing_mode  = &quot;RATE&quot;<br>    max_rate_per_endpoint = 100<br>  }</pre><pre>  log_config {<br>    enable      = true<br>    sample_rate = 1.0<br>  }<br>}</pre><pre># Backend Service for V2<br>resource &quot;google_compute_backend_service&quot; &quot;v2&quot; {<br>  name                  = &quot;demo-app-v2-backend&quot;<br>  protocol              = &quot;HTTP&quot;<br>  port_name             = &quot;http&quot;<br>  timeout_sec           = 30<br>  health_checks         = [google_compute_health_check.v2.id]<br>  load_balancing_scheme = &quot;EXTERNAL_MANAGED&quot;</pre><pre>  backend {<br>    group           = data.google_compute_network_endpoint_group.v2.id<br>    balancing_mode  = &quot;RATE&quot;<br>    max_rate_per_endpoint = 100<br>  }</pre><pre>  log_config {<br>    enable      = true<br>    sample_rate = 1.0<br>  }<br>}</pre><pre># URL Map with path-based routing<br>resource &quot;google_compute_url_map&quot; &quot;shared&quot; {<br>  name            = &quot;shared-lb-url-map&quot;<br>  default_service = google_compute_backend_service.v1.id</pre><pre>  host_rule {<br>    hosts        = [&quot;*&quot;]<br>    path_matcher = &quot;allpaths&quot;<br>  }</pre><pre>  path_matcher {<br>    name            = &quot;allpaths&quot;<br>    default_service = google_compute_backend_service.v1.id</pre><pre>    path_rule {<br>      paths   = [&quot;/v1&quot;, &quot;/v1/*&quot;]<br>      service = google_compute_backend_service.v1.id<br>    }</pre><pre>    path_rule {<br>      paths   = [&quot;/v2&quot;, &quot;/v2/*&quot;]<br>      service = google_compute_backend_service.v2.id<br>    }<br>  }<br>}</pre><pre># HTTP Proxy<br>resource &quot;google_compute_target_http_proxy&quot; &quot;shared&quot; {<br>  name    = &quot;shared-lb-http-proxy&quot;<br>  url_map = google_compute_url_map.shared.id<br>}</pre><pre># Global Forwarding Rule<br>resource &quot;google_compute_global_forwarding_rule&quot; &quot;shared&quot; {<br>  name                  = &quot;shared-lb-forwarding-rule&quot;<br>  target                = google_compute_target_http_proxy.shared.id<br>  port_range            = &quot;80&quot;<br>  load_balancing_scheme = &quot;EXTERNAL_MANAGED&quot;<br>}</pre><pre>output &quot;load_balancer_ip&quot; {<br>  value       = google_compute_global_forwarding_rule.shared.ip_address<br>  description = &quot;The IP address of the load balancer&quot;<br>}</pre><h3>Apply Terraform</h3><pre>cd terraform</pre><pre>terraform init</pre><pre>terraform plan \<br>  -var=&quot;project_id=${PROJECT_ID}&quot; \<br>  -var=&quot;region=${REGION}&quot;</pre><pre>terraform apply \<br>  -var=&quot;project_id=${PROJECT_ID}&quot; \<br>  -var=&quot;region=${REGION}&quot;</pre><pre># Get the Load Balancer IP<br>export LB_IP=$(terraform output -raw load_balancer_ip)<br>echo &quot;Load Balancer IP: ${LB_IP}&quot;</pre><p><strong>Important:</strong> It may take 5–10 minutes for the Load Balancer to be fully provisioned and healthy.</p><h3>Part 5: Testing the Setup</h3><p>Now let’s verify everything works end-to-end.</p><h3>Check Backend Health</h3><pre># Check V1 backend health<br>gcloud compute backend-services get-health demo-app-v1-backend \<br>    --global \<br>    --project=${PROJECT_ID}</pre><pre># Check V2 backend health<br>gcloud compute backend-services get-health demo-app-v2-backend \<br>    --global \<br>    --project=${PROJECT_ID}</pre><p>You should see healthy status for both backends.</p><h3>Test Application Access</h3><pre># Test V1 endpoint<br>curl http://${LB_IP}/v1</pre><pre># Expected output:<br># Hello from Demo App V1<br># Test V2 endpoint<br>curl http://${LB_IP}/v2<br># Expected output:<br># Hello from Demo App V2</pre><h3>Part 6: Creating a Helm Chart Template</h3><p>For production use, you’ll want to package this in a Helm chart. Here’s a template that application teams can use:</p><p>Create helm-chart/templates/deployment.yaml:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: {{ include &quot;app.fullname&quot; . }}<br>  labels:<br>    {{- include &quot;app.labels&quot; . | nindent 4 }}<br>spec:<br>  replicas: {{ .Values.replicaCount }}<br>  selector:<br>    matchLabels:<br>      {{- include &quot;app.selectorLabels&quot; . | nindent 6 }}<br>  template:<br>    metadata:<br>      labels:<br>        {{- include &quot;app.selectorLabels&quot; . | nindent 8 }}<br>    spec:<br>      containers:<br>      - name: {{ .Chart.Name }}<br>        image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag }}&quot;<br>        ports:<br>        - containerPort: {{ .Values.service.targetPort }}<br>        resources:<br>          {{- toYaml .Values.resources | nindent 10 }}<br>        livenessProbe:<br>          httpGet:<br>            path: {{ .Values.healthCheck.path }}<br>            port: {{ .Values.service.targetPort }}<br>          initialDelaySeconds: {{ .Values.healthCheck.initialDelaySeconds }}<br>          periodSeconds: {{ .Values.healthCheck.periodSeconds }}<br>        readinessProbe:<br>          httpGet:<br>            path: {{ .Values.healthCheck.path }}<br>            port: {{ .Values.service.targetPort }}<br>          initialDelaySeconds: {{ .Values.healthCheck.initialDelaySeconds }}<br>          periodSeconds: {{ .Values.healthCheck.periodSeconds }}</pre><p>Create helm-chart/templates/service.yaml:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: {{ include &quot;app.fullname&quot; . }}<br>  annotations:<br>    cloud.google.com/backend-config: &#39;{&quot;default&quot;: &quot;{{ include &quot;app.fullname&quot; . }}-backend-config&quot;}&#39;<br>    cloud.google.com/neg: &#39;{&quot;exposed_ports&quot;: {&quot;{{ .Values.service.port }}&quot;:{&quot;name&quot;: &quot;{{ include &quot;app.fullname&quot; . }}-neg&quot;}}}&#39;<br>spec:<br>  type: ClusterIP<br>  selector:<br>    {{- include &quot;app.selectorLabels&quot; . | nindent 4 }}<br>  ports:<br>  - port: {{ .Values.service.port }}<br>    targetPort: {{ .Values.service.targetPort }}<br>    protocol: TCP<br>    name: http</pre><p>Create helm-chart/templates/backendconfig.yaml:</p><pre>apiVersion: cloud.google.com/v1<br>kind: BackendConfig<br>metadata:<br>  name: {{ include &quot;app.fullname&quot; . }}-backend-config<br>spec:<br>  healthCheck:<br>    port: {{ .Values.service.targetPort }}<br>    requestPath: {{ .Values.healthCheck.path }}<br>    type: HTTP<br>    checkIntervalSec: {{ .Values.backendConfig.healthCheck.checkIntervalSec }}<br>    timeoutSec: {{ .Values.backendConfig.healthCheck.timeoutSec }}<br>    healthyThreshold: {{ .Values.backendConfig.healthCheck.healthyThreshold }}<br>    unhealthyThreshold: {{ .Values.backendConfig.healthCheck.unhealthyThreshold }}<br>  timeoutSec: {{ .Values.backendConfig.timeoutSec }}<br>  connectionDraining:<br>    drainingTimeoutSec: {{ .Values.backendConfig.connectionDraining.drainingTimeoutSec }}</pre><p>Create helm-chart/values.yaml:</p><pre>replicaCount: 2</pre><pre>image:<br>  repository: your-app-image<br>  tag: latest</pre><pre>service:<br>  port: 8080<br>  targetPort: 8080</pre><pre>healthCheck:<br>  path: /health<br>  initialDelaySeconds: 10<br>  periodSeconds: 5</pre><pre>backendConfig:<br>  healthCheck:<br>    checkIntervalSec: 10<br>    timeoutSec: 5<br>    healthyThreshold: 2<br>    unhealthyThreshold: 3<br>  timeoutSec: 30<br>  connectionDraining:<br>    drainingTimeoutSec: 60</pre><pre>resources:<br>  requests:<br>    memory: &quot;64Mi&quot;<br>    cpu: &quot;100m&quot;<br>  limits:<br>    memory: &quot;128Mi&quot;<br>    cpu: &quot;200m&quot;</pre><h3>Cost Analysis</h3><p>Let’s break down the savings:</p><p><strong>Before (Multiple Load Balancers):</strong></p><ul><li>18 Load Balancers × $20/month = $360/month</li><li>Additional forwarding rules = $40/month</li><li><strong>Total: ~$400/month</strong></li></ul><p><strong>After (Single Shared Load Balancer):</strong></p><ul><li>1 Load Balancer = $20/month</li><li>Forwarding rules = $5/month</li><li><strong>Total: ~$25/month</strong></li></ul><p><strong>Savings: $375/month or $4,500/year</strong> (93% reduction)</p><h3>Key Takeaways</h3><p>This architecture gives you:</p><p>✅ <strong>Massive Cost Savings:</strong> 90%+ reduction in load balancing costs<br> ✅ <strong>Clear Separation of Concerns:</strong> Platform manages infrastructure, teams manage apps<br> ✅ <strong>GitOps Ready:</strong> Everything in version control<br> ✅ <strong>Scalable:</strong> Add new services without adding new load balancers<br> ✅ <strong>Flexible Routing:</strong> Path-based or host-based routing<br> ✅ <strong>Production Ready:</strong> Health checks, connection draining, logging</p><h3>Common Pitfalls to Avoid</h3><ol><li><strong>NEG Zone Mismatch:</strong> Make sure your Terraform references the correct zone where NEGs are created</li><li><strong>Health Check Delays:</strong> Wait for backends to become healthy before testing (5–10 minutes)</li><li><strong>BackendConfig Changes:</strong> Changes to BackendConfig require recreating the NEG</li><li><strong>Firewall Rules:</strong> Ensure GCP health check ranges can reach your pods</li></ol><h3>Cleanup</h3><p>To avoid charges, clean up resources when done:</p><pre># Destroy Terraform resources<br>cd terraform<br>terraform destroy \<br>  -var=&quot;project_id=${PROJECT_ID}&quot; \<br>  -var=&quot;region=${REGION}&quot;</pre><pre># Delete Kubernetes resources<br>kubectl delete -f k8s/</pre><pre># Delete GKE cluster<br>gcloud container clusters delete ${CLUSTER_NAME} \<br>    --region=${REGION} \<br>    --project=${PROJECT_ID}</pre><pre># Delete network<br>gcloud compute networks subnets delete ${NETWORK_NAME}-subnet \<br>    --region=${REGION} \<br>    --project=${PROJECT_ID}</pre><pre>gcloud compute networks delete ${NETWORK_NAME} \<br>    --project=${PROJECT_ID}</pre><h3>Next Steps</h3><p>Want to take this further?</p><ol><li>Add HTTPS with Google-managed certificates</li><li>Implement Cloud Armor for DDoS protection</li><li>Set up Cloud CDN for static content</li><li>Add OAuth2 proxy for authentication</li><li>Implement rate limiting per backend</li></ol><h3>Conclusion</h3><p>Moving from multiple load balancers to a single shared one wasn’t just about saving money. It taught me that good architecture is about finding the right balance between cost, flexibility, and operational simplicity.</p><p>The combination of GKE’s NEG integration, Terraform for infrastructure, and Helm for application deployment creates a powerful platform that scales with your needs without scaling your costs.</p><p>How many load balancers are you running? Calculate your potential savings and let me know in the comments!</p><p><em>Found this helpful? Follow me for more cloud architecture patterns and cost optimization strategies.</em></p><p>#GCP #GKE #ALB #NEG #CostOptimization #Kubernetes #CloudCost #Terraform #DevOps #FinOps #Scale #Microservices</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c26b35685d9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From $500 to $20/Month: My Journey to Single ALB Architecture in EKS]]></title>
            <link>https://medium.com/@abdalluh.mostafa_12842/from-500-to-20-month-my-journey-to-single-alb-architecture-in-eks-0d05e1d6a6b9?source=rss-67272920beaa------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d05e1d6a6b9</guid>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Abdalluh Mostafa]]></dc:creator>
            <pubDate>Sat, 01 Nov 2025 15:49:47 GMT</pubDate>
            <atom:updated>2025-11-01T15:54:11.973Z</atom:updated>
            <content:encoded><![CDATA[<p>It was a regular Monday morning when I opened our AWS bill and nearly spat out my coffee <strong>$487 for Application Load Balancers alone.</strong> We had 23 microservices, and the AWS Load Balancer Controller had dutifully created 23 separate ALBs, one for each Ingress resource.<br>At ~$20/month per ALB, the math was brutal. We were planning to scale to over 50 services.</p><p>I knew there had to be a better way. The solution seemed obvious: <strong>create one ALB and attach multiple target groups to it, </strong>but when I tried to implement it, I hit a wall that would frustrate me for weeks.</p><h3>The Problem Nobody Talks About</h3><p>Here’s what I discovered:</p><p><strong>You can’t create standalone target groups in EKS for an existing ALB.</strong></p><p>The AWS Load Balancer Controller only creates target groups automatically when you create an Ingress resource. And even then, you get stuck with auto-generated names following this pattern:</p><pre>k8s-&lt;namespace&gt;-&lt;service-name&gt;-&lt;hash&gt;</pre><p>Example</p><pre>k8s-default-myapp-a1b2c3d4</pre><p>The hash is auto-generated (<a href="https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/a3c3cac27d00353495c80f772c637919da7a24bd/pkg/service/model_build_target_group.go#L208">see the source code</a>). You can’t control it. You can’t reference it predictably in Terraform or other infrastructure code.</p><p>I wanted to:</p><ol><li>Create <strong>ONE</strong> shared ALB (via Terraform)</li><li>Create target groups with <strong>custom, predictable names</strong> (no more auto-generated hashes!).</li><li>Manage TargetGroups using <strong>Kubernetes YAML manifests.</strong></li><li>Bind TargetGroups to Kubernetes Services using <strong>TargetGroupBinding</strong> CRDs</li><li>Attach multiple TargetGroups to the single ALB with routing rules</li></ol><p>But the AWS Load Balancer Controller doesn’t support this. There’s even an <a href="https://github.com/kubernetes-sigs/aws-load-balancer-controller/issues/2553">open GitHub issue from 2022</a> asking for this exact feature.</p><h3>The Solution: AWS Controllers for Kubernetes (ACK)</h3><p>After days of research, I discovered <strong>AWS Controllers for Kubernetes (ACK), </strong>specifically the elbv2-chart. This provides Custom Resource Definitions (CRDs) that let you create AWS ELB resources directly from Kubernetes, including target groups with any name you want.</p><p>The architecture is beautiful:</p><ul><li><strong>Platform Team</strong>: Manages one shared ALB via Terraform</li><li><strong>Application Teams</strong>: Manage their own target groups via Kubernetes YAML in Helm charts</li><li><strong>Cost</strong>: One ALB (~$20/month) instead of 23+ ALBs ($460+/month)</li></ul><h3>What We’ll Build</h3><p>In this complete demo, you’ll learn how to:</p><ol><li>Install AWS Load Balancer Controller (for TargetGroupBinding)</li><li>Install ACK ELBv2 Controller (for custom target groups)</li><li>Deploy two demo applications on EKS</li><li>Create custom-named target groups using Kubernetes YAML</li><li>Bind target groups to services</li><li>Create one ALB using Terraform</li><li>Configure host-based routing (v1.yourdomain.com, v2.yourdomain.com)</li></ol><p><strong>Result:</strong> One ALB serving multiple applications with full control over target group names and configurations.</p><h3>Prerequisites</h3><p>Before starting, ensure you have:</p><ul><li>An existing EKS cluster</li><li>kubectl configured</li><li>eksctl installed</li><li>helm installed</li><li>Terraform installed</li><li>AWS credentials configured</li><li>A VPC with public subnets</li></ul><h3>Environment Variables</h3><p>Set these variables for the entire tutorial:</p><pre>export EKS_CLUSTER=&quot;my-cluster&quot;<br>export AWS_REGION=&quot;ap-south-1&quot;<br>export AWS_ACCOUNT_ID=&quot;111122223333&quot;<br>export VPC_ID=&quot;vpc-xxxxxxxxxxxxx&quot;</pre><p>Replace with your actual values.</p><h3>Part 1: Install AWS Load Balancer Controller</h3><p>We need this for TargetGroupBinding resources to work.</p><p>1. Create IAM Policy</p><p>Download controller IAM policy:</p><pre>curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.7.2/docs/install/iam_policy.json</pre><p>Create IAM policy:</p><pre>aws iam create-policy \<br>  --policy-name AWSLoadBalancerControllerIAMPolicy \<br>  --policy-document file://iam_policy.json</pre><p>2. Create IAM Role with IRSA</p><p>Create IAM service account:</p><pre>eksctl create iamserviceaccount \<br>  --cluster=${EKS_CLUSTER} \<br>  --namespace=kube-system \<br>  --name=aws-load-balancer-controller \<br>  --role-name AmazonEKSLoadBalancerControllerRole \<br>  --attach-policy-arn=arn:aws:iam::${AWS_ACCOUNT_ID}:policy/AWSLoadBalancerControllerIAMPolicy \<br>  --approve</pre><p>3. Install via Helm</p><pre>helm repo add eks https://aws.github.io/eks-charts<br>helm repo update eks</pre><pre>helm install aws-load-balancer-controller eks/aws-load-balancer-controller \<br>  -n kube-system \<br>  --set clusterName=${EKS_CLUSTER} \<br>  --set serviceAccount.create=false \<br>  --set serviceAccount.name=aws-load-balancer-controller</pre><p>4. Verify</p><pre>kubectl get deployment -n kube-system aws-load-balancer-controller</pre><p>Expected output:</p><pre>NAME                           READY   UP-TO-DATE   AVAILABLE   AGE<br>aws-load-balancer-controller   2/2     2            2           84s</pre><h3>Part 2: Install ACK ELBv2 Controller</h3><p>This is the game-changer that lets us create target groups with custom names.</p><p>1. Create IAM Policy</p><p>Create ack-elbv2-policy.json:</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: [<br>        &quot;elasticloadbalancing:CreateTargetGroup&quot;,<br>        &quot;elasticloadbalancing:DeleteTargetGroup&quot;,<br>        &quot;elasticloadbalancing:ModifyTargetGroup&quot;,<br>        &quot;elasticloadbalancing:DescribeTargetGroups&quot;,<br>        &quot;elasticloadbalancing:DescribeTargetGroupAttributes&quot;,<br>        &quot;elasticloadbalancing:ModifyTargetGroupAttributes&quot;,<br>        &quot;elasticloadbalancing:RegisterTargets&quot;,<br>        &quot;elasticloadbalancing:DeregisterTargets&quot;,<br>        &quot;elasticloadbalancing:DescribeTargetHealth&quot;,<br>        &quot;elasticloadbalancing:AddTags&quot;,<br>        &quot;elasticloadbalancing:RemoveTags&quot;<br>      ],<br>      &quot;Resource&quot;: &quot;*&quot;<br>    },<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: [<br>        &quot;ec2:DescribeVpcs&quot;,<br>        &quot;ec2:DescribeSubnets&quot;,<br>        &quot;ec2:DescribeSecurityGroups&quot;,<br>        &quot;ec2:DescribeInstances&quot;,<br>        &quot;ec2:DescribeInstanceStatus&quot;<br>      ],<br>      &quot;Resource&quot;: &quot;*&quot;<br>    }<br>  ]<br>}</pre><p>Create the policy:</p><pre>aws iam create-policy \<br>  --policy-name ACK-ELBv2-Controller-Policy \<br>  --policy-document file://ack-elbv2-policy.json</pre><p>2. Create Namespace and Service Account</p><pre>kubectl create namespace ack-system</pre><pre>eksctl create iamserviceaccount \<br>  --name ack-elbv2-controller \<br>  --namespace ack-system \<br>  --cluster ${EKS_CLUSTER} \<br>  --role-name ACK-ELBv2-Controller-Role \<br>  --attach-policy-arn arn:aws:iam::${AWS_ACCOUNT_ID}:policy/ACK-ELBv2-Controller-Policy \<br>  --approve \<br>  --override-existing-serviceaccounts \<br>  --region ${AWS_REGION}</pre><p>3. Install ACK Controller</p><pre>helm upgrade --install ack-elbv2-controller \<br>  oci://public.ecr.aws/aws-controllers-k8s/elbv2-chart \<br>  --namespace ack-system \<br>  --set serviceAccount.create=false \<br>  --set serviceAccount.name=ack-elbv2-controller \<br>  --set aws.region=${AWS_REGION}</pre><p>4. Verify Installation</p><pre># Check pods<br>kubectl get pods -n ack-system | grep elbv2<br># Verify CRDs - THIS IS THE MAGIC! 🎉<br>kubectl get crds | grep elbv2</pre><p>You should see:</p><pre>targetgroups.elbv2.services.k8s.aws</pre><p>This CRD is what allows us to create target groups with custom names!</p><pre># Verify service account has IRSA annotation<br>kubectl get sa ack-elbv2-controller -n ack-system -o yaml</pre><h3>Part 3: Deploy Demo Applications</h3><p>Now, let’s create our applications with their services. These will be the actual workloads we want to expose through our shared ALB.</p><p>Create k8s/app-v1.yaml:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: bare-minimum-api-v1<br>  namespace: default<br>  labels:<br>    app: bare-minimum-api-v1<br>    version: v1<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: bare-minimum-api-v1<br>  template:<br>    metadata:<br>      labels:<br>        app: bare-minimum-api-v1<br>        version: v1<br>    spec:<br>      containers:<br>      - name: echo-server<br>        image: jmalloc/echo-server<br>        ports:<br>        - containerPort: 8080<br>          name: http<br>        args: [&quot;8080&quot;]<br>        resources:<br>          requests:<br>            memory: &quot;64Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;200m&quot;<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: bare-minimum-api-v1<br>  namespace: default<br>  labels:<br>    app: bare-minimum-api-v1<br>spec:<br>  type: ClusterIP<br>  selector:<br>    app: bare-minimum-api-v1<br>  ports:<br>  - port: 8080<br>    targetPort: 8080<br>    protocol: TCP<br>    name: http</pre><p>Create k8s/app-v2.yaml:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: bare-minimum-api-v2<br>  namespace: default<br>  labels:<br>    app: bare-minimum-api-v2<br>    version: v2<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: bare-minimum-api-v2<br>  template:<br>    metadata:<br>      labels:<br>        app: bare-minimum-api-v2<br>        version: v2<br>    spec:<br>      containers:<br>      - name: echo-server<br>        image: jmalloc/echo-server<br>        ports:<br>        - containerPort: 8080<br>          name: http<br>        args: [&quot;8080&quot;]<br>        resources:<br>          requests:<br>            memory: &quot;64Mi&quot;<br>            cpu: &quot;100m&quot;<br>          limits:<br>            memory: &quot;128Mi&quot;<br>            cpu: &quot;200m&quot;<br>---<br>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: bare-minimum-api-v2<br>  namespace: default<br>  labels:<br>    app: bare-minimum-api-v2<br>spec:<br>  type: ClusterIP<br>  selector:<br>    app: bare-minimum-api-v2<br>  ports:<br>  - port: 8080<br>    targetPort: 8080<br>    protocol: TCP<br>    name: http</pre><p>Deploy both applications:</p><pre>kubectl apply -f k8s/app-v1.yaml<br>kubectl apply -f k8s/app-v2.yaml</pre><pre># Verify deployments<br>kubectl get pods -l app=bare-minimum-api-v1<br>kubectl get pods -l app=bare-minimum-api-v2</pre><pre># Verify services<br>kubectl get svc -l app</pre><p>Expected output:</p><pre>NAME                   TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE<br>bare-minimum-api-v1    ClusterIP   10.100.123.45    &lt;none&gt;        8080/TCP   30s<br>bare-minimum-api-v2    ClusterIP   10.100.123.46    &lt;none&gt;        8080/TCP   30s</pre><h3>Part 4: Create Target Groups with Custom Names</h3><p><strong>This is the breakthrough!</strong> We can now create target groups with ANY name we want using Kubernetes YAML, perfect for Helm charts!</p><p><strong>Important:</strong> Notice we’re creating these target groups <strong>WITHOUT an ALB existing yet</strong>. This is the key advantage of using ACK. target groups are independent AWS resources.</p><p>Create k8s/targetgroup-v1.yaml:</p><pre>apiVersion: elbv2.services.k8s.aws/v1alpha1<br>kind: TargetGroup<br>metadata:<br>  name: bare-minimum-api-v1<br>  namespace: default<br>spec:<br>  name: bare-minimum-api-v1  # YOUR TARGET GROUP NAME!<br>  targetType: ip<br>  port: 8080<br>  protocol: HTTP<br>  vpcID: vpc-xxxxxxxxxxxxx  # Replace with your VPC ID<br>  healthCheckPath: /<br>  healthCheckPort: &quot;traffic-port&quot;<br>  healthCheckProtocol: HTTP<br>  healthyThresholdCount: 2<br>  unhealthyThresholdCount: 2<br>  healthCheckTimeoutSeconds: 5<br>  healthCheckIntervalSeconds: 10<br>  matcher:<br>    httpCode: &quot;200-299&quot;<br>  tags:<br>    - key: app<br>      value: bare-minimum-api-v1<br>    - key: managed-by<br>      value: kubernetes<br>    - key: cost-center<br>      value: application-team</pre><p>Create k8s/targetgroup-v2.yaml:</p><pre>apiVersion: elbv2.services.k8s.aws/v1alpha1<br>kind: TargetGroup<br>metadata:<br>  name: bare-minimum-api-v2<br>  namespace: default<br>spec:<br>  name: bare-minimum-api-v2  # YOUR TARGET GROUP NAME!<br>  targetType: ip<br>  port: 8080<br>  protocol: HTTP<br>  vpcID: vpc-xxxxxxxxxxxxx  # Replace with your VPC ID<br>  healthCheckPath: /<br>  healthCheckPort: &quot;traffic-port&quot;<br>  healthCheckProtocol: HTTP<br>  healthyThresholdCount: 2<br>  unhealthyThresholdCount: 2<br>  healthCheckTimeoutSeconds: 5<br>  healthCheckIntervalSeconds: 10<br>  matcher:<br>    httpCode: &quot;200-299&quot;<br>  tags:<br>    - key: app<br>      value: bare-minimum-api-v2<br>    - key: managed-by<br>      value: kubernetes<br>    - key: cost-center<br>      value: application-team</pre><p>Apply the target groups:</p><pre># Replace VPC_ID in the files first!<br>sed -i &quot;s/vpc-xxxxxxxxxxxxx/${VPC_ID}/g&quot; k8s/targetgroup-*.yaml</pre><pre>kubectl apply -f k8s/targetgroup-v1.yaml<br>kubectl apply -f k8s/targetgroup-v2.yaml</pre><pre># Watch them being created in Kubernetes<br>kubectl get targetgroups -w</pre><p>Expected output:</p><pre>NAME                   AGE<br>bare-minimum-api-v1    10s<br>bare-minimum-api-v2    10s</pre><p>Verify in AWS Console or CLI:</p><pre>aws elbv2 describe-target-groups \<br>  --names bare-minimum-api-v1 bare-minimum-api-v2 \<br>  --region ${AWS_REGION}</pre><p><strong>Amazing!</strong> You now have target groups with predictable, custom names created from Kubernetes manifests, and we haven’t even created the ALB yet!</p><h3>Part 5: Bind Target Groups to Services</h3><p>Now we’ll connect our Kubernetes Services to the AWS Target Groups using TargetGroupBinding. This resource tells the AWS Load Balancer Controller to register the pod IPs as targets in the target group.</p><p>Create k8s/targetgroupbinding-v1.yaml:</p><pre>apiVersion: elbv2.k8s.aws/v1beta1<br>kind: TargetGroupBinding<br>metadata:<br>  name: v1-targetgroupbinding<br>  namespace: default<br>spec:<br>  serviceRef:<br>    name: bare-minimum-api-v1  # Kubernetes Service<br>    port: 8080<br>  targetGroupName: bare-minimum-api-v1  # References our custom-named TG<br>  targetType: ip</pre><p>Create k8s/targetgroupbinding-v2.yaml:</p><pre>apiVersion: elbv2.k8s.aws/v1beta1<br>kind: TargetGroupBinding<br>metadata:<br>  name: v2-targetgroupbinding<br>  namespace: default<br>spec:<br>  serviceRef:<br>    name: bare-minimum-api-v2  # Kubernetes Service<br>    port: 8080<br>  targetGroupName: bare-minimum-api-v2  # References our custom-named TG<br>  targetType: ip</pre><p>Apply the bindings:</p><pre>kubectl apply -f k8s/targetgroupbinding-v1.yaml<br>kubectl apply -f k8s/targetgroupbinding-v2.yaml</pre><pre># Verify bindings<br>kubectl get targetgroupbindings -n default</pre><p>Expected output:</p><pre>NAME                    SERVICE-NAME            SERVICE-PORT   TARGET-TYPE   AGE<br>v1-targetgroupbinding   bare-minimum-api-v1     8080           ip            15s<br>v2-targetgroupbinding   bare-minimum-api-v2     8080           ip            15s</pre><p>Check target health in AWS (it should show healthy targets):</p><pre># Get target group ARN and check health for v1<br>TG_ARN_V1=$(aws elbv2 describe-target-groups \<br>  --names bare-minimum-api-v1 \<br>  --query &#39;TargetGroups[0].TargetGroupArn&#39; \<br>  --output text \<br>  --region ${AWS_REGION})<br><br>aws elbv2 describe-target-health \<br>  --target-group-arn ${TG_ARN_V1} \<br>  --region ${AWS_REGION}<br><br># Check v2<br>TG_ARN_V2=$(aws elbv2 describe-target-groups \<br>  --names bare-minimum-api-v2 \<br>  --query &#39;TargetGroups[0].TargetGroupArn&#39; \<br>  --output text \<br>  --region ${AWS_REGION})<br>aws elbv2 describe-target-health \<br>  --target-group-arn ${TG_ARN_V2} \<br>  --region ${AWS_REGION}</pre><p>You should see your pod IPs registered and showing as healthy! 🎉</p><p><strong>Key Point:</strong> Notice we’ve done all this <strong>without creating an ALB yet</strong>. The target groups exist independently, with pod IPs already registered. Now we just need to create the ALB and point it to these target groups.</p><h3>Part 6: Create the Shared ALB with Terraform</h3><p>Now that our applications, target groups, and bindings are all set up, let’s create the single shared ALB that will route traffic to all our services.</p><p>Create terraform/main.tf:</p><pre>terraform {<br>  required_version = &quot;&gt;= 1.0&quot;<br>  required_providers {<br>    aws = {<br>      source  = &quot;hashicorp/aws&quot;<br>      version = &quot;~&gt; 5.0&quot;<br>    }<br>  }<br>}<br>provider &quot;aws&quot; {<br>  region = var.aws_region<br>}<br>variable &quot;vpc_id&quot; {<br>  description = &quot;Your existing VPC ID&quot;<br>  type        = string<br>}<br>variable &quot;subnet_ids&quot; {<br>  description = &quot;Your existing public subnet IDs (at least 2)&quot;<br>  type        = list(string)<br>}<br>variable &quot;aws_region&quot; {<br>  type    = string<br>  default = &quot;ap-south-1&quot;<br>}<br># Reference the target groups created by ACK<br>data &quot;aws_lb_target_group&quot; &quot;v1&quot; {<br>  name = &quot;bare-minimum-api-v1&quot;<br>}<br>data &quot;aws_lb_target_group&quot; &quot;v2&quot; {<br>  name = &quot;bare-minimum-api-v2&quot;<br>}<br># The Single Shared ALB<br>resource &quot;aws_lb&quot; &quot;shared&quot; {<br>  name               = &quot;shared-alb&quot;<br>  internal           = false<br>  load_balancer_type = &quot;application&quot;<br>  subnets            = var.subnet_ids<br>  tags = {<br>    Name      = &quot;shared-alb&quot;<br>    ManagedBy = &quot;terraform&quot;<br>  }<br>}<br># HTTP Listener<br>resource &quot;aws_lb_listener&quot; &quot;http&quot; {<br>  load_balancer_arn = aws_lb.shared.arn<br>  port              = &quot;80&quot;<br>  protocol          = &quot;HTTP&quot;<br>  default_action {<br>    type = &quot;fixed-response&quot;<br>    fixed_response {<br>      content_type = &quot;text/plain&quot;<br>      message_body = &quot;No route matched&quot;<br>      status_code  = &quot;404&quot;<br>    }<br>  }<br>}<br># Route v1.abdalluh.com -&gt; Target Group v1<br>resource &quot;aws_lb_listener_rule&quot; &quot;v1&quot; {<br>  listener_arn = aws_lb_listener.http.arn<br>  priority     = 100<br>  action {<br>    type             = &quot;forward&quot;<br>    target_group_arn = data.aws_lb_target_group.v1.arn<br>  }<br>  condition {<br>    host_header {<br>      values = [&quot;v1.abdalluh.com&quot;]<br>    }<br>  }<br>}<br># Route v2.abdalluh.com -&gt; Target Group v2<br>resource &quot;aws_lb_listener_rule&quot; &quot;v2&quot; {<br>  listener_arn = aws_lb_listener.http.arn<br>  priority     = 200<br>  action {<br>    type             = &quot;forward&quot;<br>    target_group_arn = data.aws_lb_target_group.v2.arn<br>  }<br>  condition {<br>    host_header {<br>      values = [&quot;v2.abdalluh.com&quot;]<br>    }<br>  }<br>}<br>output &quot;alb_dns_name&quot; {<br>  value = aws_lb.shared.dns_name<br>}</pre><p>Apply Terraform</p><pre>terraform init<br><br>terraform apply \<br>  -var=&quot;vpc_id=${VPC_ID}&quot; \<br>  -var=&#39;subnet_ids=[&quot;subnet-xxx&quot;,&quot;subnet-yyy&quot;]&#39;<br><br># Save the ALB DNS<br>export ALB_DNS=$(terraform output -raw alb_dns_name)<br>echo &quot;ALB DNS: ${ALB_DNS}&quot;</pre><p><strong>Cost Checkpoint:</strong> You now have ONE ALB (~$20/month) serving multiple applications! 🎉</p><h3>Part 7: Testing the Complete Setup</h3><p>Now let’s test that everything works end-to-end.</p><p>Test Using ALB DNS with Host Headers</p><p>Test App 1</p><pre># Test v1<br>curl -H &quot;Host: v1.abdalluh.com&quot; http://${ALB_DNS}</pre><p>Expected response (from echo server):</p><pre>Request served by bare-minimum-api-v1-xxxxx<br>HTTP/1.1 GET /<br>Host: v1.abdalluh.com<br>User-Agent: curl/7.68.0<br>...</pre><p>Test App2</p><pre># Test v2<br>curl -H &quot;Host: v2.abdalluh.com&quot; http://${ALB_DNS}</pre><p>Expected response (from echo server):</p><pre>Request served by bare-minimum-api-v2-xxxxx<br>HTTP/1.1 GET /<br>Host: v2.abdalluh.com<br>User-Agent: curl/7.68.0<br>...</pre><h3>Final Thoughts</h3><p>This journey from a $500 AWS bill to $20/month taught me that the best optimizations come from questioning assumptions. The AWS Load Balancer Controller is great for quick starts, but when managing dozens of microservices, taking control pays off — literally.</p><p><strong>What you get with this approach:</strong></p><ul><li>💰 95% cost reduction on load balancers</li><li>🎯 Full control over target group naming</li><li>🔄 GitOps-ready with Helm charts</li><li>🤝 Clear separation between platform and app teams</li></ul><h3>Your Turn</h3><ol><li>Count your ALBs → Calculate your potential savings</li><li>Start with 2–3 services as proof of concept</li><li>Scale gradually once validated</li></ol><p><strong>How much did you save?</strong> Drop your results in the comments! Found this useful? Share it with your team. 🚀</p><p><strong>Tags:</strong> #AWS #EKS #Kubernetes #CostOptimization #CloudNative #DevOps #Terraform #ACK #LoadBalancer</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d05e1d6a6b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>