<?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 Gurumoorthy Raghupathy on Medium]]></title>
        <description><![CDATA[Stories by Gurumoorthy Raghupathy on Medium]]></description>
        <link>https://medium.com/@webtechguru?source=rss-76eb01cd90d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*72qmTyShSBROW9E_eWDdtw.jpeg</url>
            <title>Stories by Gurumoorthy Raghupathy on Medium</title>
            <link>https://medium.com/@webtechguru?source=rss-76eb01cd90d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:47:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@webtechguru/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[Effective GKE Management With Terraform & Kustomize (with code)]]></title>
            <link>https://medium.com/doit-international/effective-gke-management-with-terraform-kustomize-with-code-7456cf0e44d2?source=rss-76eb01cd90d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7456cf0e44d2</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[kustomize]]></category>
            <category><![CDATA[lets-encrypt]]></category>
            <dc:creator><![CDATA[Gurumoorthy Raghupathy]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 15:02:45 GMT</pubDate>
            <atom:updated>2023-09-27T11:36:57.357Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyhm8xSYEwM46stZa_UU1w.png" /><figcaption>Effective GKE Management Using Terraform &amp; Kustomize</figcaption></figure><p>Managing GKE (k8s) clusters and applications inside them has become a never ending battle for many of us. Managing various attributes like node-pools / add-ons / ingress controllers / SSL certificate manager / rollout of applications and its associated configuration accurately has become cumbersome for many. This has become more common given the rise of micro-services and event-driven architecture having many components.</p><h3>Managing GKE ( K8S ) clusters</h3><p>GKE / K8S cluster setup is a complicated process. A good approach is to automate the creation part as a IAC artefact. We will be using terraform as the IAC tool in this article.</p><h4>IAC Setup</h4><p>Creating modules with parameters / attributes for every resources is the key to maintain environment consistency (parity). We will have 3 modules in our repo. 1. GKE Cluster module having two node pools. 2. nginx ingress controller module using helm chart provisioner. 3. kcert letsencrypt SSL certificate provider module for your public endpoints.</p><p>The Code for all the below modules are provided in our repository at <em>: </em><a href="https://github.com/agileguru/gke_nginx_kcert_quick_start"><em>https://github.com/agileguru/gke_nginx_kcert_quick_start</em></a></p><ul><li><strong>Provisioning GKE Cluster with multiple node-pools</strong><br>In this <a href="https://github.com/agileguru/gke_nginx_kcert_quick_start/tree/main/modules/gke">module</a> we have main.tf, variables.tf and outputs.tf for provisioning / parameterizing / resuable metadata for a GKE cluster respectively.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0YL8SFVAx3PH6yNHu2rgQ.png" /><figcaption>GKE Terraform IAC Module screenshot</figcaption></figure><ul><li><strong>Installation of nginx ingress controller<br></strong>In this <a href="https://github.com/agileguru/gke_nginx_kcert_quick_start/tree/main/modules/nginx_controller">module</a> we have main.tf, variables.tf and an optional (empty) outputs.tf for provisioning / parameterizing nignx controller respectively.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mAiOxfP5lDwEsG8-_v1ItA.png" /><figcaption>NGINX Terraform IAC provisioner main.tf screenshot</figcaption></figure><ul><li><strong>Installation of kcert Letsencrypt SSL manager<br></strong>In this <a href="https://github.com/agileguru/gke_nginx_kcert_quick_start/tree/main/modules/kcert">module</a> we we have main.tf, variables.tf and an optional (empty) outputs.tf for provisioning / parameterizing kcert SSL controller respectively.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pp_QlMoU39aztmOVkP1G5w.png" /><figcaption>Kcert Terraform IAC provisioner main.tf screenshot</figcaption></figure><ul><li><strong>Orchestrating Everything Together</strong><br>After finishing the 3 modules we will now create a “devops” k8s environment by creating <a href="https://github.com/agileguru/gke_nginx_kcert_quick_start/tree/main/environments/devops">“devops” module</a> which is called from the <a href="https://github.com/agileguru/gke_nginx_kcert_quick_start/blob/main/main.tf">main / root </a>to club everything together.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVITFF1mQ-kA_OKEnq1DCw.png" /><figcaption>Devops k8s Environment Module screenshot</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSFNGeVQCiazoKtvdcISyQ.png" /><figcaption>Root orchestrate creating Devops Module screenshot</figcaption></figure><ul><li><strong>Provision the cluster and controllers with terraform <br></strong>* Change the project / region / zone name in variables.tf <br>* Change the bucket name in backend.tf after creating in gcp console<br>* Execute the following commands</li></ul><blockquote>terraform init<br>terraform plan -var-file=sample.tfvars ( change sample.tfvars if needed)<br>terraform apply -var-file=sample.tfvars ( change sample.tfvars if needed)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZfzJ36uU4YU9iMAV1wayyQ.png" /></figure><ol><li>After executing terraform commands, you will get the IP address of the LoadBalancer for domain registration.</li><li>You can get the kubectl config usig the command …</li></ol><blockquote><strong>gcloud container clusters get-credentials &lt;cluster name&gt; — zone &lt;cluster zone&gt; — project &lt;project id having the cluster&gt;</strong></blockquote><h3>Managing deployments using Kustomize</h3><p>Cluster is now ready for workload deployment. We will be using Kustomize plugin to manage it in a easier way. We will use a simple use case for this article.</p><ul><li>We have 2 apps api-1 and api-2 based on tutum/hello-world image.</li><li>We also have 2 k8s namespaces corresponding to DEV &amp; SIT environments.</li><li>We need to deploy the service and expose it via https (ssl ) with respective configurations / deployment / service and ingress mapping.</li><li>We need to store this in a repository. For Demo it is stored in our repository at <a href="https://github.com/agileguru/kustomize_quickstart_demo"><em>https://github.com/agileguru/kustomize_quickstart_demo</em></a></li></ul><p><strong>Step 1 : Creating the folder structure</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XaT8nbz53qZEBruCBCloMw.png" /><figcaption>Base Folders of components and configurations</figcaption></figure><p><strong>Step 2 : Customise each environment using overlays</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P_5nweyR-2Vv_kz2CZjBOw.png" /><figcaption>Overlays Folders For Environments using patch / merge config using kustomize.yaml</figcaption></figure><p><strong>Step 3 : Change Ingress Host Name Mapping</strong></p><p>Change hostname in dev-ingress-patch.json &amp; sit-ingress-patch.json to valid host / domain. It looks similar to code given below…</p><pre>[<br>    {<br>        &quot;op&quot;: &quot;replace&quot;,<br>        &quot;path&quot;: &quot;/spec/rules/0/host&quot;,<br>        &quot;value&quot;: &quot;dev.agileguru.org&quot;<br>    },<br>    {<br>        &quot;op&quot;: &quot;replace&quot;,<br>        &quot;path&quot;: &quot;/spec/tls/0/hosts/0&quot;,<br>        &quot;value&quot;: &quot;dev.agileguru.org&quot;<br>    }<br>]</pre><pre>[<br>    {<br>        &quot;op&quot;: &quot;replace&quot;,<br>        &quot;path&quot;: &quot;/spec/rules/0/host&quot;,<br>        &quot;value&quot;: &quot;sit.agileguru.org&quot;<br>    },<br>    {<br>        &quot;op&quot;: &quot;replace&quot;,<br>        &quot;path&quot;: &quot;/spec/tls/0/hosts/0&quot;,<br>        &quot;value&quot;: &quot;sit.agileguru.org&quot;<br>    }<br>]</pre><p><strong>Step 4 : Deploying your Applications</strong></p><pre>$ kubectl apply -k overlays/dev<br>namespace/dev created<br>configmap/config-map-api-1 created<br>configmap/config-map-api-2 created<br>service/api-1-service created<br>service/api-2-service created<br>deployment.apps/api-1-deployment created<br>deployment.apps/api-2-deployment created </pre><p><strong>Step 5 : Un-deploying your Applications</strong></p><pre>$ kubectl delete -k overlays/dev<br>namespace &quot;dev&quot; deleted<br>configmap &quot;config-map-api-1&quot; deleted<br>configmap &quot;config-map-api-2&quot; deleted<br>service &quot;api-1-service&quot; deleted<br>service &quot;api-2-service&quot; deleted<br>deployment.apps &quot;api-1-deployment&quot; deleted<br>deployment.apps &quot;api-2-deployment&quot; deleted<br>ingress.networking.k8s.io &quot;app-ingress&quot; deleted</pre><h3>Kustomize Best Practices</h3><ol><li><strong>Things To You Need To Do</strong><br> — <em>Keep the Replica Count to 0 in the base configuration<br> — Always Specify the Namespace in Overlay kustomization.yaml<br> — Always Dry Run with yaml output to ensure accuracy<br> — Good Naming Conventions for folders and manifest files<br>— Keep Ingress Mapping in its own-folder<br> — Always have override.yaml in for each component.</em></li><li><strong>Things You Should Not Do</strong><br> — <em>Hard-Coding namespace in Base Configurations<br> — Mix Configurations and Application Code In the Same Folder<br> — Git branches for Environment configuration ( know as parity drift )</em></li></ol><h3>Conclusion</h3><p>After completing the above steps we have 1. k8s which is easy to manage / upgrade with nginx and kcert SSL certificate manager without having to manage you SSL certificates ever for your public endpoints. 2. Mechanism / Framework to manage your secure web based endpoints following IAC / Devops / DRY principles.</p><h3>Resources</h3><ol><li><em>GKE Nginx Kcert getting Started Repo : </em><a href="https://github.com/agileguru/gke_nginx_kcert_quick_start"><em>https://github.com/agileguru/gke_nginx_kcert_quick_start</em></a></li><li><em>Kustomize Quick Started Repo : </em><a href="https://github.com/agileguru/kustomize_quickstart_demo"><em>https://github.com/agileguru/kustomize_quickstart_demo</em></a></li><li><em>Kustomize Docs : </em><a href="https://kustomize.io/"><em>https://kustomize.io/</em></a></li><li><em>Kcert GitHub : </em><a href="https://github.com/nabsul/kcert"><em>https://github.com/nabsul/kcert</em></a></li><li><em>Nginx Controller : </em><a href="https://kubernetes.github.io/ingress-nginx/"><em>https://kubernetes.github.io/ingress-nginx/</em></a></li><li><em>LetsEncrypt : </em><a href="https://letsencrypt.org/"><em>https://letsencrypt.org/</em></a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7456cf0e44d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/doit-international/effective-gke-management-with-terraform-kustomize-with-code-7456cf0e44d2">Effective GKE Management With Terraform &amp; Kustomize (with code)</a> was originally published in <a href="https://medium.com/doit-international">DoiT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>