<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gilbert Chris</title>
    <description>The latest articles on DEV Community by Gilbert Chris (@gilbert_chris_81108416cc1).</description>
    <link>https://dev.to/gilbert_chris_81108416cc1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1871798%2F8a48213b-bfa1-47f5-b30d-a9a32b47b7f7.jpg</url>
      <title>DEV Community: Gilbert Chris</title>
      <link>https://dev.to/gilbert_chris_81108416cc1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gilbert_chris_81108416cc1"/>
    <language>en</language>
    <item>
      <title>Namespaces are just labels on a door: building a zero-trust lab on my laptop</title>
      <dc:creator>Gilbert Chris</dc:creator>
      <pubDate>Mon, 09 Nov 2026 08:23:59 +0000</pubDate>
      <link>https://dev.to/gilbert_chris_81108416cc1/namespaces-are-just-labels-on-a-door-building-a-zero-trust-lab-on-my-laptop-3o8a</link>
      <guid>https://dev.to/gilbert_chris_81108416cc1/namespaces-are-just-labels-on-a-door-building-a-zero-trust-lab-on-my-laptop-3o8a</guid>
      <description>&lt;p&gt;Two namespaces, two tenants, problem solved. It's the assumption I see most often when teams start sharing a cluster, and it's wrong.&lt;/p&gt;

&lt;p&gt;A namespace is a naming boundary. A pod in &lt;code&gt;tenant-b&lt;/code&gt; can still reach a Service in &lt;code&gt;tenant-a&lt;/code&gt; by DNS name, and Kubernetes won't object, because by default the network is flat.&lt;/p&gt;

&lt;p&gt;[TODO: if you used to believe this yourself, say so in one sentence here. If not, delete this line.]&lt;/p&gt;

&lt;p&gt;I wanted to see the problem and then close it, so I built a small lab on my machine. This post walks through what's in it, what each layer actually does, and the places where the behaviour surprised me. Everything is in the repo: &lt;a href="https://github.com/GilbertKamau/kubernetes-multi-tenant-zero-trust-lab" rel="noopener noreferrer"&gt;kubernetes-multi-tenant-zero-trust-lab&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One caveat up front. The lab runs on &lt;strong&gt;Kind&lt;/strong&gt; with Docker Desktop on Windows: one control-plane node, two workers, Istio on top. It is not GKE. I give a talk on this topic that covers GKE Enterprise and Binary Authorization, but this repo demonstrates the ideas locally, and I'll point out where that difference matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;Each tenant gets its own namespace with Istio sidecar injection on. &lt;code&gt;tenant-a&lt;/code&gt; runs a frontend and a backend, two replicas each, and every pod has an Envoy sidecar next to the app container. Each workload runs under its own ServiceAccount: &lt;code&gt;frontend-sa&lt;/code&gt; and &lt;code&gt;backend-sa&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That last detail matters more than it looks. In a mesh, a workload's identity is its ServiceAccount. If everything runs as &lt;code&gt;default&lt;/code&gt;, you can't tell workloads apart, and every policy you write afterwards is vague. "One ServiceAccount per workload" is step one of the rollout checklist at the end of this post.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbvrpyoqd10mnyico16uj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbvrpyoqd10mnyico16uj.png" alt="Lab architecture: tenant-a frontend and backend, a tenant-b curl pod, istiod and the admission policy inside a Kind cluster" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  An IP address is not an identity
&lt;/h2&gt;

&lt;p&gt;The old way to restrict traffic is an IP allow-list. In Kubernetes, pod IPs get recycled within seconds, so an IP tells you where a packet came from and nothing about who sent it.&lt;/p&gt;

&lt;p&gt;Istio gives each workload a short-lived certificate that encodes who it is: trust domain, namespace and service account. The private key stays in the pod's memory and the certificate rotates on its own (typically about a day), so there is no long-lived credential to leak.&lt;/p&gt;

&lt;p&gt;Turning on enforcement takes one small resource:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;kubectl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;get&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;peerauthentication&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tenant-a&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;NAME&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="nx"&gt;MODE&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nx"&gt;STRICT&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;STRICT means the sidecars refuse any connection that isn't mutual TLS. Both sides have to prove who they are.&lt;/p&gt;

&lt;h2&gt;
  
  
  mTLS does not authorize anything
&lt;/h2&gt;

&lt;p&gt;This is the part that catches people out, and the demo exists to show it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tenant-b&lt;/code&gt; is also in the mesh, so its pods have perfectly valid certificates. mTLS tells the backend &lt;em&gt;who is calling&lt;/em&gt;. It says nothing about whether that caller &lt;em&gt;should be allowed in&lt;/em&gt;. Authentication and authorization are separate jobs, and mTLS only does the first.&lt;/p&gt;

&lt;p&gt;[TODO: one or two sentences on your own reaction the first time you saw tenant-b get through the handshake, or what you expected to happen.]&lt;/p&gt;

&lt;p&gt;The second job belongs to &lt;code&gt;AuthorizationPolicy&lt;/code&gt;. Mine says four things about the backend:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it applies to the backend pods&lt;/li&gt;
&lt;li&gt;the caller must be the &lt;code&gt;frontend-sa&lt;/code&gt; identity&lt;/li&gt;
&lt;li&gt;the request must carry a valid JWT principal&lt;/li&gt;
&lt;li&gt;only &lt;code&gt;GET&lt;/code&gt; is allowed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then I ran a throwaway curl pod from &lt;code&gt;tenant-b&lt;/code&gt; against the backend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;kubectl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tenant-b-demo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tenant-b&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;curlimages/curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;Never&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-sS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-o&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/dev/null&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-w&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"%{http_code}\n"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http://backend-service.tenant-a.svc.cluster.local&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;403
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The request reached the backend, and the backend's sidecar turned it away. The network said yes and the identity layer said no. That's the moment in the demo where people tend to nod.&lt;/p&gt;

&lt;h2&gt;
  
  
  401 and 403 mean different things here
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;RequestAuthentication&lt;/code&gt; validates JWTs, so it's natural to assume it rejects requests that have no token. It doesn't. It only checks a token &lt;em&gt;if one is present&lt;/em&gt;. Here's what the frontend pod gets back:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Request from the frontend pod&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No token&lt;/td&gt;
&lt;td&gt;403&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Garbage token (&lt;code&gt;invalidToken&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Valid token&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Valid token, &lt;code&gt;DELETE&lt;/code&gt; method&lt;/td&gt;
&lt;td&gt;403&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A missing token gets a 403 because the AuthorizationPolicy demands an authenticated principal and finds none. A broken token gets a 401 because it fails validation before authorization is even evaluated. So when you're debugging a mesh and see a 403, you can't tell from the code alone whether the caller is wrong, the token is missing or the method is disallowed. You have to look further.&lt;/p&gt;

&lt;p&gt;[TODO: how long the 401/403 difference took you to work out, or what you checked first. Delete if it didn't trip you up.]&lt;/p&gt;

&lt;p&gt;The last case shows that even the right workload with a valid token can't do everything. &lt;code&gt;frontend-sa&lt;/code&gt; can GET and that's all. This is the granularity NetworkPolicy can't give you, because it works at layers 3 and 4 and can't tell a GET from a DELETE. I'd still keep NetworkPolicy as an outer fence and add the mesh on top.&lt;/p&gt;

&lt;p&gt;For the demo I used Istio's public sample JWT. That's fine in a lab and not something to copy into production.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3dgycub7xigmxzpw7awu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3dgycub7xigmxzpw7awu.png" alt="Request decision flow: mTLS, then RequestAuthentication, then AuthorizationPolicy, with the 200, 401 and 403 outcomes" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading what the sidecar saw
&lt;/h2&gt;

&lt;p&gt;Encrypted traffic is opaque on the wire. But the sidecar terminates the TLS, so it sees the method, the path and the caller, and it can log them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;kubectl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;logs&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$backendPod&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tenant-a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;istio-proxy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--since&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 200s and 403s are right there in those logs. Envoy also keeps counters, and I like these because they show enforcement actually happening:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;kubectl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$backendPod&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tenant-a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;istio-proxy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;pilot-agent&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;GET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;stats&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Select-String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rbac.allowed|rbac.denied"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Send another request from &lt;code&gt;tenant-b&lt;/code&gt; and &lt;code&gt;rbac.denied&lt;/code&gt; goes up. One gotcha: it goes up on whichever replica handled the request, so with two backend pods you may need to check both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pinning images, and what that does and doesn't prove
&lt;/h2&gt;

&lt;p&gt;The last layer is about what's allowed to &lt;em&gt;run&lt;/em&gt;. If an attacker can deploy their own container under a trusted ServiceAccount, they inherit that identity. Identity controls only work if the workloads behind them are trustworthy.&lt;/p&gt;

&lt;p&gt;In the lab, both Deployments reference the image by SHA-256 digest instead of a tag like &lt;code&gt;latest&lt;/code&gt;, which pins the exact image content. A &lt;code&gt;ValidatingAdmissionPolicy&lt;/code&gt; then rejects any Deployment in &lt;code&gt;tenant-a&lt;/code&gt; whose images don't use a digest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;kubectl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;deployment&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;image-test&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;nginx:latest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;tenant-a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--dry-run&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;All container images must use a SHA-256 digest.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The properly pinned manifest passes a server-side dry run.&lt;/p&gt;

&lt;p&gt;I want to be careful about how much this shows. Digest pinning tells you &lt;em&gt;which bytes&lt;/em&gt; you're running. It doesn't tell you who built them or whether you should trust them. My admission policy doesn't verify signatures, attestations or provenance, and it is &lt;strong&gt;not&lt;/strong&gt; Binary Authorization. That product checks signed attestations on the exact digest at admission time, with signing keys held in a KMS. In a real GKE setup the pipeline builds the image, scans it, signs the digest, and the admission controller refuses anything without a valid attestation. The lab covers only the first, simplest step of that chain, and I'd rather say so plainly than let the demo imply more.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you roll this out for real
&lt;/h2&gt;

&lt;p&gt;I'd go in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;One ServiceAccount per workload, before anything else.&lt;/li&gt;
&lt;li&gt;Inject sidecars and run mTLS in PERMISSIVE mode first.&lt;/li&gt;
&lt;li&gt;Watch the telemetry to find who still sends plaintext, then go STRICT namespace by namespace.&lt;/li&gt;
&lt;li&gt;Default-deny each tenant namespace, then grant access explicitly.&lt;/li&gt;
&lt;li&gt;Add layer-7 and JWT rules, using Istio's dry-run annotation first so a new policy only logs what it &lt;em&gt;would&lt;/em&gt; deny.&lt;/li&gt;
&lt;li&gt;Bring in image signing in audit mode before you enforce it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each step is reversible and observable, which is how you do this in production without taking something down on a Friday.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Identity beats IP addresses. mTLS authenticates but doesn't authorize. And a trusted identity is only as safe as the image running behind it.&lt;/p&gt;

&lt;p&gt;The commands, manifests and a rehearsal runbook are in the &lt;a href="https://github.com/GilbertKamau/kubernetes-multi-tenant-zero-trust-lab" rel="noopener noreferrer"&gt;repo&lt;/a&gt;. If you spot something I got wrong, open an issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 2 with GKE coming up...&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>istio</category>
      <category>security</category>
      <category>devops</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Gilbert Chris</dc:creator>
      <pubDate>Mon, 22 Dec 2025 09:04:38 +0000</pubDate>
      <link>https://dev.to/gilbert_chris_81108416cc1/-2abp</link>
      <guid>https://dev.to/gilbert_chris_81108416cc1/-2abp</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/gilbert_chris_81108416cc1" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1871798%2F8a48213b-bfa1-47f5-b30d-a9a32b47b7f7.jpg" alt="gilbert_chris_81108416cc1"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/gilbert_chris_81108416cc1/serverless-africa-building-smarter-apps-with-google-cloud-functions-a-practical-demo-from-devfest-5a7a" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Serverless Africa: Building Smarter Apps with Google Cloud Functions A practical demo from DevFest Mt Kenya&lt;/h2&gt;
      &lt;h3&gt;Gilbert Chris ・ Dec 22&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#devfest&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#gcp&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#pubsub&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#serverless&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>devfest</category>
      <category>gcp</category>
      <category>pubsub</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Serverless Africa: Building Smarter Apps with Google Cloud Functions A practical demo from DevFest Mt Kenya</title>
      <dc:creator>Gilbert Chris</dc:creator>
      <pubDate>Mon, 22 Dec 2025 09:04:15 +0000</pubDate>
      <link>https://dev.to/gilbert_chris_81108416cc1/serverless-africa-building-smarter-apps-with-google-cloud-functions-a-practical-demo-from-devfest-5a7a</link>
      <guid>https://dev.to/gilbert_chris_81108416cc1/serverless-africa-building-smarter-apps-with-google-cloud-functions-a-practical-demo-from-devfest-5a7a</guid>
      <description>&lt;p&gt;“What if you could ship scalable applications without constantly worrying about servers, infrastructure, and backend chaos?”&lt;/p&gt;

&lt;p&gt;That was the guiding question behind my talk at DevFest Mt Kenya 2025, where I explored how serverless architecture on Google Cloud Platform (GCP) can simplify backend development while enabling powerful, real-world solutions.&lt;/p&gt;

&lt;p&gt;To avoid abstract theory, I built and demonstrated a small but complete project called Anime-san—a serverless application that ties together frontend, Cloud Run, Pub/Sub, Cloud Functions, and an M-Pesa STK Push flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Serverless Matters (Especially in Africa)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In many African developer ecosystems, teams are small, resources are limited, and products need to scale quickly once they gain traction. Traditional backend setups often introduce challenges like:&lt;/p&gt;

&lt;p&gt;Server provisioning and maintenance&lt;/p&gt;

&lt;p&gt;Downtime handling&lt;/p&gt;

&lt;p&gt;Scaling during traffic spikes&lt;/p&gt;

&lt;p&gt;Complex deployments&lt;/p&gt;

&lt;p&gt;Serverless platforms like Google Cloud Functions and Cloud Run shift this burden to the cloud provider. Developers can focus on business logic, not infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Demo Project: Anime-san&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Anime-san is a lightweight demo app with a simple idea:&lt;/p&gt;

&lt;p&gt;Display random anime quotes&lt;/p&gt;

&lt;p&gt;Allow users to “tip” the developer via an STK Push (demo flow)&lt;/p&gt;

&lt;p&gt;Process requests asynchronously using cloud-native services&lt;/p&gt;

&lt;p&gt;Despite its simplicity, it demonstrates a real production-style architecture.&lt;/p&gt;

&lt;p&gt;High-Level Architecture&lt;/p&gt;

&lt;p&gt;The project is split into three main parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Frontend (React)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Fetches random quotes from a public Anime API&lt;/p&gt;

&lt;p&gt;Displays quotes in a clean UI&lt;/p&gt;

&lt;p&gt;Sends tip requests to the backend&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Backend API (Cloud Run)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Built with Node.js and Express&lt;/p&gt;

&lt;p&gt;Exposes a /tip endpoint&lt;/p&gt;

&lt;p&gt;Publishes tip requests to a Pub/Sub topic&lt;/p&gt;

&lt;p&gt;Runs fully serverless on Cloud Run&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cloud Function Subscriber&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Listens to the Pub/Sub topic&lt;/p&gt;

&lt;p&gt;Processes incoming tip events&lt;/p&gt;

&lt;p&gt;Triggers an STK Push flow (demo/sandbox)&lt;/p&gt;

&lt;p&gt;This decoupled approach ensures the system is scalable, resilient, and event-driven.&lt;/p&gt;

&lt;p&gt;Why Pub/Sub?&lt;/p&gt;

&lt;p&gt;Instead of handling everything synchronously, the backend publishes messages to Google Cloud Pub/Sub.&lt;/p&gt;

&lt;p&gt;Benefits:&lt;/p&gt;

&lt;p&gt;Loose coupling between services&lt;/p&gt;

&lt;p&gt;Better error handling and retries&lt;/p&gt;

&lt;p&gt;Easier scaling&lt;/p&gt;

&lt;p&gt;Cleaner separation of concerns&lt;/p&gt;

&lt;p&gt;This pattern is especially useful for payment flows, notifications, and background processing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;M-Pesa Integration (Demo Context)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While the demo uses sandbox credentials, it reflects real-world patterns used in production M-Pesa integrations:&lt;/p&gt;

&lt;p&gt;Backend validates and publishes payment intent&lt;/p&gt;

&lt;p&gt;Subscriber handles payment logic asynchronously&lt;/p&gt;

&lt;p&gt;Frontend gets immediate feedback without blocking&lt;/p&gt;

&lt;p&gt;This architecture works well for:&lt;/p&gt;

&lt;p&gt;Fintech applications&lt;/p&gt;

&lt;p&gt;E-commerce platforms&lt;/p&gt;

&lt;p&gt;Donation and tipping systems&lt;/p&gt;

&lt;p&gt;Utility and service-payment apps&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lessons from the Demo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Serverless reduces cognitive load&lt;br&gt;
Less time spent managing servers means more time building features.&lt;/p&gt;

&lt;p&gt;Event-driven systems scale naturally&lt;br&gt;
Pub/Sub and Cloud Functions make it easy to handle growth.&lt;/p&gt;

&lt;p&gt;Local problems deserve global tools&lt;br&gt;
Combining M-Pesa with modern cloud tools unlocks powerful local solutions.&lt;/p&gt;

&lt;p&gt;Demos matter&lt;br&gt;
Seeing a system work end-to-end is far more effective than slides alone.&lt;/p&gt;

&lt;p&gt;Why This Matters for GDG Communities&lt;/p&gt;

&lt;p&gt;The goal of this demo wasn’t just to show GCP features—it was to inspire developers to:&lt;/p&gt;

&lt;p&gt;Build confidently with cloud-native tools&lt;/p&gt;

&lt;p&gt;Think in events, not monoliths&lt;/p&gt;

&lt;p&gt;Design systems that scale from day one&lt;/p&gt;

&lt;p&gt;Apply global technology to local challenges&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Serverless is not magic—but when used correctly, it’s a force multiplier.&lt;/p&gt;

&lt;p&gt;Anime-san may be a small demo, but it represents a bigger idea:&lt;br&gt;
African developers can build scalable, production-ready systems using modern cloud platforms—today.&lt;/p&gt;

&lt;p&gt;Huge thanks to GDG Mt Kenya and everyone who attended the session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is the repo:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/GilbertKamau/Anime-san-Cloud-Functions" rel="noopener noreferrer"&gt;https://github.com/GilbertKamau/Anime-san-Cloud-Functions&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devfest</category>
      <category>gcp</category>
      <category>pubsub</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Building a Scalable Backend with DynamoDB Streams — My Journey Before the AWS User Group Pwani Talk</title>
      <dc:creator>Gilbert Chris</dc:creator>
      <pubDate>Sat, 06 Dec 2025 23:10:32 +0000</pubDate>
      <link>https://dev.to/gilbert_chris_81108416cc1/building-a-scalable-backend-with-dynamodb-streams-my-journey-before-the-aws-user-group-pwani-talk-5bnl</link>
      <guid>https://dev.to/gilbert_chris_81108416cc1/building-a-scalable-backend-with-dynamodb-streams-my-journey-before-the-aws-user-group-pwani-talk-5bnl</guid>
      <description>&lt;p&gt;When I agreed to give an online presentation to the AWS User Group Pwani, I knew I didn’t want to show slides full of theory. I wanted something real. Something I could build, demo, and explain — a project that actually does something.&lt;/p&gt;

&lt;p&gt;So I decided to create a small but scalable backend system using:&lt;/p&gt;

&lt;p&gt;API Gateway&lt;/p&gt;

&lt;p&gt;AWS Lambda&lt;/p&gt;

&lt;p&gt;DynamoDB&lt;/p&gt;

&lt;p&gt;DynamoDB Streams&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwm5gjyz0svj77ddht6p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwm5gjyz0svj77ddht6p.png" alt="Image describing a scalable backend architecture" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything worked perfectly during the live session (thank God 😅),&lt;br&gt;
but the journey of building it before the talk…&lt;br&gt;
that’s where the real learning happened.&lt;/p&gt;

&lt;p&gt;This blog is about that journey — what I built, what surprised me, and the gems I picked up along the way.&lt;/p&gt;

&lt;p&gt;Let’s dive in.&lt;/p&gt;

&lt;p&gt;🌱 Why This Project?&lt;/p&gt;

&lt;p&gt;Before the presentation, I wanted to answer one question:&lt;/p&gt;

&lt;p&gt;“How can you build a backend that can scale to millions of users without managing servers?”&lt;/p&gt;

&lt;p&gt;AWS has many ways to answer that question, but DynamoDB Streams stood out because:&lt;/p&gt;

&lt;p&gt;they’re simple but powerful&lt;/p&gt;

&lt;p&gt;they’re event-driven&lt;/p&gt;

&lt;p&gt;they allow your backend to react to data in real-time&lt;/p&gt;

&lt;p&gt;If you’ve ever wanted to track changes in your database — who registered, who updated their profile, who deleted their account — Streams are the perfect tool.&lt;/p&gt;

&lt;p&gt;🧠 DynamoDB Streams — Explained Like You're 10&lt;/p&gt;

&lt;p&gt;Think of your DynamoDB table as a notebook.&lt;/p&gt;

&lt;p&gt;Every time someone writes in it:&lt;/p&gt;

&lt;p&gt;adds a new line&lt;/p&gt;

&lt;p&gt;edits a line&lt;/p&gt;

&lt;p&gt;erases a line&lt;/p&gt;

&lt;p&gt;DynamoDB Streams captures that event like a security camera.&lt;/p&gt;

&lt;p&gt;Then it whispers to your Lambda function:&lt;/p&gt;

&lt;p&gt;“Hey, someone added a new user!”&lt;/p&gt;

&lt;p&gt;“Hey, someone updated their email!”&lt;/p&gt;

&lt;p&gt;“Hey, someone deleted an item!”&lt;/p&gt;

&lt;p&gt;Your Lambda can react instantly.&lt;/p&gt;

&lt;p&gt;That’s the magic of event-driven architecture.&lt;/p&gt;

&lt;p&gt;🛠️ Step 1: Building the Backend API&lt;/p&gt;

&lt;p&gt;I started with the essentials:&lt;/p&gt;

&lt;p&gt;✔ API Gateway endpoint → /register&lt;br&gt;
✔ Lambda function → validates &amp;amp; stores user data&lt;br&gt;
✔ DynamoDB table → Users&lt;br&gt;
✔ Duplicate checks → no repeated emails/usernames&lt;/p&gt;

&lt;p&gt;When a user registers, the API saves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`{
  "name": "Alice",
  "email": "alice@gmail.com",
  "username": "al"
}
`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`{"message": "User registered successfully"}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple. Clean. Serverless.&lt;/p&gt;

&lt;p&gt;🔄 Step 2: Turning on DynamoDB Streams&lt;/p&gt;

&lt;p&gt;Next, I enabled Streams on the Users table with:&lt;/p&gt;

&lt;p&gt;Stream type: NEW_AND_OLD_IMAGES&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;p&gt;for INSERT → record the new item&lt;/p&gt;

&lt;p&gt;for MODIFY → record both old + new&lt;/p&gt;

&lt;p&gt;for DELETE → record the old one&lt;/p&gt;

&lt;p&gt;Then I connected the Stream to a new Lambda:&lt;/p&gt;

&lt;p&gt;📌 LogUserChangesFunction&lt;/p&gt;

&lt;p&gt;This Lambda would “listen” to any change on the table.&lt;/p&gt;

&lt;p&gt;⚙️ Step 3: Building the Stream Processor Lambda&lt;/p&gt;

&lt;p&gt;Here’s the Lambda handler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const handler = async (event) =&amp;gt; {
  console.log("=== DynamoDB Stream Event Received ===");
  for (const record of event.Records) {
    const type = record.eventName;
    try {
      if (type === "INSERT") {
        console.log("USER ADDED:", JSON.stringify(record.dynamodb.NewImage));
      } else if (type === "MODIFY") {
        console.log("USER UPDATED - OLD:", JSON.stringify(record.dynamodb.OldImage));
        console.log("USER UPDATED - NEW:", JSON.stringify(record.dynamodb.NewImage));
      } else if (type === "REMOVE") {
        console.log("USER DELETED:", JSON.stringify(record.dynamodb.OldImage));
      } else {
        console.log("UNKNOWN EVENT:", type, record);
      }
    } catch (err) {
      console.error("Error processing record:", err, record);
      throw err;
    }
  }
  return { statusCode: 200 };
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tiny function became my “activity logger” for the entire database.&lt;/p&gt;

&lt;p&gt;🧪 Step 4: Testing — Where the Learning Really Happened&lt;/p&gt;

&lt;p&gt;This is where the real story lives.&lt;/p&gt;

&lt;p&gt;📌 Mistake 1: Expecting Streams to Show Old Data&lt;/p&gt;

&lt;p&gt;I added a new user named Alice before I turned on Streams.&lt;/p&gt;

&lt;p&gt;Later, when I checked logs…&lt;br&gt;
no event.&lt;/p&gt;

&lt;p&gt;Because:&lt;/p&gt;

&lt;p&gt;☑️ Streams only capture events that happen after you enable them.&lt;br&gt;
❌ They do NOT show past historical changes.&lt;/p&gt;

&lt;p&gt;📌 Mistake 2: Updating an Item Is Not an Insert&lt;/p&gt;

&lt;p&gt;When I updated Eve’s username from toto → kichwa, I got:&lt;/p&gt;

&lt;p&gt;USER UPDATED - OLD: ...&lt;br&gt;
USER UPDATED - NEW: ...&lt;/p&gt;

&lt;p&gt;Perfect.&lt;/p&gt;

&lt;p&gt;📌 Mistake 3: IAM Is the Silent Gatekeeper&lt;/p&gt;

&lt;p&gt;At first, I got errors like:&lt;/p&gt;

&lt;p&gt;“Cannot access stream. Ensure GetRecords, ListStreams permissions…”&lt;/p&gt;

&lt;p&gt;Streams won’t even fire unless IAM is correct.&lt;/p&gt;

&lt;p&gt;Give Lambda:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`dynamodb:GetRecords

dynamodb:GetShardIterator

dynamodb:DescribeStream

dynamodb:ListStreams`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After fixing that, everything worked flawlessly.&lt;/p&gt;

&lt;p&gt;📈 Why This Architecture Is Actually Scalable&lt;/p&gt;

&lt;p&gt;This simple system becomes extremely powerful because each part scales automatically:&lt;/p&gt;

&lt;p&gt;1️⃣ API Gateway&lt;/p&gt;

&lt;p&gt;Handles thousands of requests per second.&lt;/p&gt;

&lt;p&gt;2️⃣ Lambda&lt;/p&gt;

&lt;p&gt;Scales by spawning new instances based on traffic.&lt;/p&gt;

&lt;p&gt;3️⃣ DynamoDB&lt;/p&gt;

&lt;p&gt;Scales horizontally and supports millions of reads/writes per second.&lt;/p&gt;

&lt;p&gt;4️⃣ Streams&lt;/p&gt;

&lt;p&gt;Process events asynchronously without slowing down the main API.&lt;/p&gt;

&lt;p&gt;Together, they form a backend that can grow from 10 users to 10 million without refactoring.&lt;/p&gt;

&lt;p&gt;No servers.&lt;br&gt;
No patching.&lt;br&gt;
No worrying about capacity.&lt;/p&gt;

&lt;p&gt;Just pure scalability.&lt;/p&gt;

&lt;p&gt;🧩 What I Learned (The Real Takeaways)&lt;br&gt;
✔ Serverless is not about writing less code&lt;/p&gt;

&lt;p&gt;It’s about letting the platform handle scaling.&lt;/p&gt;

&lt;p&gt;✔ Real scalability comes from loose coupling&lt;/p&gt;

&lt;p&gt;Streams turn your system into Lego blocks that talk to each other.&lt;/p&gt;

&lt;p&gt;✔ IAM is everything&lt;/p&gt;

&lt;p&gt;You can write perfect code and still get blocked by one missing permission.&lt;/p&gt;

&lt;p&gt;✔ Logs are your best debugging tool&lt;/p&gt;

&lt;p&gt;Every DynamoDB event tells a story.&lt;/p&gt;

&lt;p&gt;✔ Event-driven architecture is addictive&lt;/p&gt;

&lt;p&gt;Once you start using Streams… you start seeing events everywhere.&lt;/p&gt;

&lt;p&gt;🎤 Final Thoughts&lt;/p&gt;

&lt;p&gt;When I finally gave the presentation to AWS User Group Pwani, everything worked smoothly — no errors, no surprises, just a clean demo.&lt;/p&gt;

&lt;p&gt;But the real win was everything I learned before that moment.&lt;/p&gt;

&lt;p&gt;I didn’t just build an API.&lt;br&gt;
I built a scalable, event-driven backend using real AWS production tools.&lt;/p&gt;

&lt;p&gt;More importantly:&lt;/p&gt;

&lt;p&gt;I gained a deeper understanding of how modern backends should behave — reactive, decoupled, scalable, and effortless to maintain.&lt;/p&gt;

&lt;p&gt;If you're curious about serverless, DynamoDB Streams is one of the best ways to start.&lt;br&gt;
Simple idea → big power.&lt;/p&gt;

&lt;p&gt;And who knows — your next small experiment might become your next talk or your next startup.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>aws</category>
      <category>dynamodb</category>
      <category>lambda</category>
    </item>
  </channel>
</rss>
