<?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 Cloud with Hamza on Medium]]></title>
        <description><![CDATA[Stories by Cloud with Hamza on Medium]]></description>
        <link>https://medium.com/@hamza46?source=rss-ee4d65e7e94b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4lKsHgWfIkClCXIzPAc7zw.png</url>
            <title>Stories by Cloud with Hamza on Medium</title>
            <link>https://medium.com/@hamza46?source=rss-ee4d65e7e94b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:50:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hamza46/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[Kubernetes Pod Stuck in Pending? How Multiple Node Taints Break Scheduling]]></title>
            <link>https://medium.com/@hamza46/why-your-kubernetes-pod-is-stuck-in-pending-debugging-multiple-node-taints-91cb97331126?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/91cb97331126</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[cka]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 16:32:39 GMT</pubDate>
            <atom:updated>2026-11-02T16:36:18.834Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nlg21HBVAFjkEmfE1BneGA.png" /></figure><p><em>A systematic troubleshooting approach to FailedScheduling errors, YAML pitfalls, and multi-taint node conflicts.</em></p><h3>Overview</h3><p>A pod stuck in Pending is one of the most common scheduling problems in Kubernetes, and one of the most misdiagnosed. This article walks through a real troubleshooting scenario on a Kubernetes v1.35 cluster where a pod failed to schedule because of two layered issues: an invalid manifest structure, and a node carrying multiple taints of which the pod tolerated only one.</p><p>By the end, you will know how to read scheduler events, audit node taints, and fix toleration mismatches quickly.</p><p><strong>Environment</strong></p><ul><li>Kubernetes version: v1.35.0</li><li>Cluster: 1 control plane (controlplane) and 1 worker (node01)</li><li>Workload: standalone Pod bee (nginx)</li><li>Objective: schedule bee onto node01 using tolerations</li></ul><h3>Background: Taints and Tolerations</h3><p>Taints and tolerations work together to control which pods may run on which nodes.</p><ul><li>A <strong>taint</strong> is applied to a node and repels pods that do not explicitly tolerate it.</li><li>A <strong>toleration</strong> is applied to a pod and allows (but does not force) scheduling onto nodes with matching taints.</li></ul><p>There are three taint effects:</p><ul><li>NoSchedule: new pods without a matching toleration are not scheduled. Running pods are unaffected.</li><li>PreferNoSchedule: the scheduler tries to avoid the node, but it is a soft rule.</li><li>NoExecute: new pods are rejected and existing pods without a toleration are evicted.</li></ul><p>Apply a taint:</p><pre>kubectl taint nodes node01 spray=mortein:NoSchedule</pre><h3>Issue 1: Invalid Pod Manifest (Strict Decoding Error)</h3><p>The first attempt to create the pod failed at the API server:</p><p>Error from server (BadRequest): error when creating “bee.yaml”: Pod in version “v1”<br>cannot be handled as a Pod: strict decoding error:<br>unknown field “spec.containers[0].tolerations”</p><p><strong>Faulty manifest</strong></p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br> name: bee<br>spec:<br> containers:<br> - name: nginx<br> image: nginx<br> tolerations: # wrong level: inside the container<br> - key: spray<br> value: mortein<br> effect: NoSchedule</pre><p><strong>Root cause:</strong> tolerations is a pod-level field (spec.tolerations), not a container-level field. The error path spec.containers[0].tolerations points directly at the problem.</p><p><strong>Corrected manifest</strong></p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br> name: bee<br>spec:<br> containers:<br> - name: nginx<br> image: nginx<br> tolerations: # same level as containers<br> - key: spray<br> operator: Equal<br> value: mortein<br> effect: NoSchedule</pre><p><strong>Takeaway:</strong> read the field path in strict decoding errors. It tells you exactly where the parser disagrees with the schema. To avoid indentation mistakes, generate a base manifest and extend it:</p><p>kubectl run bee — image=nginx — dry-run=client -o yaml &gt; bee.yaml</p><h3>Issue 2: Pod Stuck in Pending With “untolerated taint(s)”</h3><p>After the manifest was accepted, the pod stayed in Pending.</p><p>kubectl describe pod bee</p><p>Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s<br> node.kubernetes.io/unreachable:NoExecute op=Exists for 300s<br> spray=mortein:NoSchedule<br>Events:<br> Warning FailedScheduling 35s default-scheduler<br> 0/2 nodes are available: 2 node(s) had untolerated taint(s).<br> preemption: 0/2 nodes are available: 2 Preemption is not helpful for scheduling.</p><h3>How to read this event</h3><ul><li>0/2 nodes are available: the scheduler evaluated both nodes and rejected both.</li><li>2 node(s) had untolerated taint(s): each node has at least one taint the pod does not tolerate.</li><li>Preemption is not helpful: evicting other pods would not change the outcome, because the blocker is a taint, not a resource shortage.</li></ul><h3>Investigation</h3><p>Audit the taints on every node:</p><pre>kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints<br>kubectl describe node node01 | grep -A3 Taints<br>kubectl describe node controlplane | grep -A3 Taints</pre><p>Findings:</p><ul><li>controlplane: node-role.kubernetes.io/control-plane:NoSchedule (default, expected)</li><li>node01: spray=mortein:NoSchedule and [REPLACE: WRONG-KEY=WRONG-VALUE:EFFECT]</li></ul><h3>Root cause</h3><p>node01 carried two taints. The pod’s toleration matched only the first one (spray=mortein:NoSchedule). The second taint was a misconfiguration introduced while applying taints, and the pod had no toleration for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jz6NZ5isHmL1qFXDjALn3g.png" /></figure><p><strong>Key concept:</strong> a pod must tolerate every taint on a node to be scheduled there. Tolerations are evaluated per taint, and a single unmatched taint with NoSchedule or NoExecute is enough to reject the node. Tolerating one of two taints is the same as tolerating none.</p><h3>Resolution</h3><p>The incorrect taint was removed by appending — to the taint specification:</p><p>kubectl taint nodes node01 [REPLACE: WRONG-KEY=WRONG-VALUE:EFFECT]-</p><p>Verify that only the intended taint remains:</p><pre>kubectl describe node node01 | grep -A2 Taints</pre><blockquote>Taints: spray=mortein:NoSchedule</blockquote><p>Because the scheduler continuously retries Pending pods, no redeploy is required. The pod was scheduled automatically:</p><pre>kubectl get pod bee -o wide</pre><p>NAME READY STATUS NODE<br>bee 1/1 Running node01</p><p>The alternative fix, when the taint is legitimate, is to add a matching toleration to the pod. Remember that spec.tolerations on a bare Pod cannot be freely modified after creation. Recreate the pod, or edit the pod template if the workload is managed by a Deployment.</p><h3>Troubleshooting Checklist</h3><ol><li>Validate the manifest: kubectl apply — dry-run=server -f pod.yaml</li><li>Read the events: kubectl describe pod &lt;name&gt; and focus on FailedScheduling.</li><li>Audit node taints: kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints</li><li>Compare key, value, operator, and effect between each taint and the pod’s tolerations. All four must align.</li><li>Check for multiple taints on the target node. Every one needs a matching toleration.</li><li>Remove or tolerate: delete the stale taint with -, or add the missing toleration.</li><li>Verify placement: kubectl get pod &lt;name&gt; -o wide</li></ol><h3>Useful Commands</h3><pre># Taint a node<br>kubectl taint nodes node01 key=value:NoSchedule<br># Remove a taint<br>kubectl taint nodes node01 key=value:NoSchedule-<br># Remove all taints for a key<br>kubectl taint nodes node01 key-<br># List pods running on a specific node<br>kubectl get pods -A -o wide - field-selector spec.nodeName=node01<br># Show all pending pods across the cluster<br>kubectl get pods -A - field-selector status.phase=Pending</pre><h3>Best Practices</h3><ul><li><strong>Taints restrict, tolerations permit.</strong> A toleration never forces placement. Pair it with nodeSelector or nodeAffinity to target a node deliberately.</li><li><strong>Keep taint naming consistent</strong> (for example team=payments:NoSchedule) to avoid typos and near-duplicate keys.</li><li><strong>Audit taints after any node change</strong> and treat them as configuration that deserves review.</li><li><strong>Use controllers (Deployment, StatefulSet) instead of bare Pods</strong> so scheduling constraints can be updated through the pod template.</li><li><strong>Understand tolerationSeconds:</strong> it applies only to NoExecute and controls how long a pod remains bound before eviction. Kubernetes injects a default of 300s for not-ready and unreachable.</li><li><strong>Codify node taints in IaC</strong> (Terraform, Ansible, or kubelet — register-with-taints) so they are reproducible and reviewable.</li></ul><h3>Conclusion</h3><p>What looked like a single scheduling failure was actually two independent problems: a schema-level error in the manifest, and a node with an extra, unintended taint. The scheduler’s event message pointed to the cause immediately, once read carefully.</p><p>The core lessons:</p><ul><li>Strict decoding errors give you the exact field path of the mistake.</li><li>untolerated taint(s) means a taint mismatch, not a capacity problem.</li><li>A pod must tolerate all taints on a node, so always inspect the full taint list.</li></ul><p>A methodical approach (events first, then node state, then manifest comparison) resolves most scheduling incidents in minutes.</p><p><em>If you found this useful, follow for more hands-on Kubernetes, DevOps, and cloud infrastructure content.<br>Follow Me on Linkedin 👉 </em><a href="https://www.linkedin.com/in/hamza-ejaz-619764292/">https://www.linkedin.com/in/hamza-ejaz-619764292/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91cb97331126" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Hetzner Cloud VM Scheduling with Bash, Cron, and SendGrid Email Notifications]]></title>
            <link>https://medium.com/@hamza46/automating-hetzner-cloud-vm-scheduling-with-bash-cron-and-sendgrid-email-notifications-3dbdad7cbde4?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dbdad7cbde4</guid>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 22:13:32 GMT</pubDate>
            <atom:updated>2026-07-28T22:13:32.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6tGaGT-r21tKvyRssIugWw.png" /></figure><p>How I reduced infrastructure costs by automatically starting and stopping production VMs on a schedule using the Hetzner Cloud API, Bash scripts, Cron, and SendGrid.</p><h3><strong>The Problem:</strong></h3><h4>Our production environment contained multiple application and engine VMs.</h4><p>These servers only needed to be online during customer working hours.</p><p>Keeping them powered on 24 hours a day increased monthly infrastructure costs without providing any additional business value.</p><p>Manual power management wasn’t a practical option because:</p><ul><li>Engineers could forget to start or stop servers.</li><li>Manual operations don’t scale.</li><li>There was no central reporting.</li><li>The operations team had no visibility into scheduled actions.</li></ul><p>I wanted a solution that was fully automated, reliable, and easy to maintain.</p><h3>Solution Overview</h3><p>Instead of introducing Kubernetes jobs or an external orchestration platform, I built a lightweight scheduler using native Linux tools.</p><p>The solution consists of:</p><ul><li><strong>Ubuntu Monitoring Server</strong></li><li><strong>Bash scripts</strong></li><li><strong>Linux Cron</strong></li><li><strong>Hetzner Cloud API</strong></li><li><strong>SendGrid Email API</strong></li><li><strong>jq</strong></li><li><strong>curl</strong></li></ul><p>Everything runs from a single server.</p><p>Architecture</p><pre>                       Ubuntu Monitoring Server<br>                               │<br>                         Cron Scheduler<br>                               │<br>                 ┌─────────────┴─────────────┐<br>                 │                           │<br>          Start Scheduler              Stop Scheduler<br>                 │                           │<br>                 └─────────────┬─────────────┘<br>                               │<br>                     Hetzner Cloud API<br>                               │<br>          ┌──────────────────────────────────────┐<br>          │                                      │<br>     Application VMs                       Engine VMs<br>          │                                      │<br>          └──────────────────────────────────────┘<br>                               │<br>                     SendGrid Email Reports<br>                               │<br>                    Operations / DevOps Team</pre><p>Project Structure:</p><pre>hetzner-scheduler/<br>.env<br>servers.txt<br>start-vms.sh<br>stop-vm.sh<br>send-email.sh</pre><p>Configuration:<br>.env</p><pre>HCLOUD_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxx<br>SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxx<br>SENDGRID_FROM_EMAIL=noreply@example.com<br>EMAIL_TO=devops@example.com,ops@example.com</pre><h3>How the Scheduler Works</h3><p>For every server listed in servers.txt, the script performs the following workflow:</p><ol><li>Read the VM name.</li><li>Query the Hetzner Cloud API to retrieve the server ID.</li><li>Check the current power status.</li><li>Skip the VM if it’s already in the desired state.</li><li>Trigger the power action.</li><li>Wait until the server reaches the requested state.</li><li>Record the result.</li><li>Continue with the next server.</li><li>Send a single summary email after all VMs have been processed.</li></ol><p>This approach prevents false success notifications because the script confirms the final VM state before reporting completion.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dbdad7cbde4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting a Static Website on AWS S3 Using Terraform]]></title>
            <link>https://medium.com/@hamza46/hosting-a-static-website-on-aws-s3-using-terraform-3f1fee192b7e?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f1fee192b7e</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing-services]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Fri, 20 Feb 2026 16:31:00 GMT</pubDate>
            <atom:updated>2026-02-20T17:07:03.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ELnW7WLBAhZZgLtvb5rqEA.png" /></figure><p><strong>Introduction:</strong></p><p>In today’s DevOps world, manually clicking through the AWS Console to create resources is considered an anti-pattern. The modern approach is Infrastructure as Code defining your entire infrastructure in version-controlled files, just like application code.</p><p>In this project, I automated the complete setup of a static website hosted on AWS S3 using Terraform. Everything from creating the S3 bucket, configuring public access, enabling website hosting, uploading the HTML files, and attaching a bucket policy was done with a single <strong>terraform apply</strong> command.<br>By the end of this blog, you will:</p><ul><li>Understand the project architecture</li><li>Know every Terraform resource used and <em>why</em></li><li>Be able to reproduce this project from scratch</li><li>Learn best practices around variables, providers, and state</li></ul><p>🔗 <strong>GitHub Repository:</strong> <a href="https://github.com/Hamza844/AWS-S3-Static-Website-Hosting-using-Terraform"><strong>AWS-S3-Static-Website-Hosting-using-Terraform</strong></a></p><p><strong>🧠 What is Terraform?:</strong></p><p>Terraform is an open-source Infrastructure as Code tool built by HashiCorp. It allows you to define cloud resources in a declarative language called HCL HashiCorp Configuration Language. Instead of manually provisioning resources, you write configuration files and Terraform handles the creation, update, and deletion of your infrastructure automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o6utOfGzgthV7X_sR-tVqg.png" /></figure><h3>What Is AWS S3 Static Website Hosting?</h3><p>Amazon S3, or Simple Storage Service, is an object storage service built to store any kind of file. When you enable static website hosting on an S3 bucket, it begins serving your HTML, CSS, and JavaScript files directly over HTTP with no web server, no EC2 instance, and no monthly server bills.</p><blockquote>Why <strong>S3</strong> for Static Websites?S3 is extremely cost-effective (you pay only for storage and requests), provides 99.999999999% durability, scales automatically with any amount of traffic, and integrates seamlessly with CloudFront for CDN and HTTPS support.</blockquote><h3>Step-by-Step Implementation</h3><h4><strong>1- Clone the Repository:</strong></h4><pre>git clone https://github.com/Hamza844/AWS-S3-Static-Website-Hosting-using-Terraform.git<br>cd AWS-S3-Static-Website-Hosting-using-Terraform</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*dY7xDjA12GScpT5zkGOzaA.png" /></figure><p><strong>2- Configure the Provider (provider.tf):<br></strong>The provider.tf file tells Terraform which cloud provider to use and how to authenticate with it. Here we configure the official HashiCorp AWS provider and pass our credentials through variables — never as hardcoded values.</p><pre>terraform {<br>  required_providers {<br>    aws = {<br>      source = &quot;hashicorp/aws&quot;<br>      version = &quot;6.32.1&quot;<br>    }<br>  }<br>}<br>provider &quot;aws&quot; {<br>  region = &quot;eu-west-1&quot;<br>}</pre><h4>3- Declare Variables (variable.tf)</h4><p>Variables make Terraform configurations flexible, reusable, and secure. Instead of repeating values throughout your code, you define them once and reference them everywhere.</p><pre>variable &quot;aws_region&quot; {<br>  description = &quot;AWS region to deploy resources&quot;<br>  type        = string<br>  default     = &quot;us-east-1&quot;<br>}<br><br>variable &quot;aws_access_key&quot; {<br>  description = &quot;AWS Access Key&quot;<br>  type        = string<br>  sensitive   = true<br>}<br><br>variable &quot;aws_secret_key&quot; {<br>  description = &quot;AWS Secret Key&quot;<br>  type        = string<br>  sensitive   = true<br>}<br><br>variable &quot;bucket_name&quot; {<br>  description = &quot;Name of the S3 bucket (must be globally unique)&quot;<br>  type        = string<br>}</pre><h4><strong>4- Set Your Variable Values (terraform.tfvars):</strong></h4><p>Copy the example file and fill in your real values:</p><pre>cp terraform.tfvars.example terraform.tfvars</pre><pre>aws_region     = &quot;us-east-1&quot;<br>aws_access_key = &quot;YOUR_ACCESS_KEY_HERE&quot;<br>aws_secret_key = &quot;YOUR_SECRET_KEY_HERE&quot;<br>bucket_name    = &quot;my-static-website-hamza-2024&quot;</pre><h4>5- Write the Core Infrastructure (main.tf):</h4><p>This resource creates the actual S3 bucket in your AWS account. The force_destroy flag allows Terraform to delete the bucket even when it still contains files, which is useful when cleaning up.</p><p>By default, AWS blocks all public access to S3 buckets as a security measure. For a public website, we need to explicitly turn this off so that visitors on the Internet can read the files</p><pre>resource &quot;aws_s3_bucket&quot; &quot;static_site&quot; {<br>  bucket = var.bucket_name<br>}<br><br># Disable block public access<br>resource &quot;aws_s3_bucket_public_access_block&quot; &quot;public_access&quot; {<br>  bucket = aws_s3_bucket.static_site.id<br><br>  block_public_acls       = false<br>  block_public_policy     = false<br>  ignore_public_acls      = false<br>  restrict_public_buckets = false<br>}<br><br># Enable static website hosting<br>resource &quot;aws_s3_bucket_website_configuration&quot; &quot;website_config&quot; {<br>  bucket = aws_s3_bucket.static_site.id<br><br>  index_document {<br>    suffix = &quot;index.html&quot;<br>  }<br><br>  error_document {<br>    key = &quot;error.html&quot;<br>  }<br>}<br><br># Bucket Policy (IMPORTANT)<br>resource &quot;aws_s3_bucket_policy&quot; &quot;bucket_policy&quot; {<br>  bucket = aws_s3_bucket.static_site.id<br><br>  depends_on = [<br>    aws_s3_bucket_public_access_block.public_access<br>  ]<br><br>  policy = jsonencode({<br>    Version = &quot;2012-10-17&quot;<br>    Statement = [{<br>      Effect = &quot;Allow&quot;<br>      Principal = &quot;*&quot;<br>      Action = &quot;s3:GetObject&quot;<br>      Resource = &quot;${aws_s3_bucket.static_site.arn}/*&quot;<br>    }]<br>  })<br>}<br><br># Upload index.html<br>resource &quot;aws_s3_object&quot; &quot;index&quot; {<br>  bucket = aws_s3_bucket.static_site.id<br>  key    = &quot;index.html&quot;<br>  source = &quot;website/index.html&quot;<br>  content_type = &quot;text/html&quot;<br>  etag = filemd5(&quot;website/index.html&quot;)<br>}<br><br># Upload error.html<br>resource &quot;aws_s3_object&quot; &quot;error&quot; {<br>  bucket = aws_s3_bucket.static_site.id<br>  key    = &quot;error.html&quot;<br>  source = &quot;website/error.html&quot;<br>  content_type = &quot;text/html&quot;<br>  etag = filemd5(&quot;website/error.html&quot;)<br>}<br><br># Output website URL<br>output &quot;website_url&quot; {<br>  value = aws_s3_bucket_website_configuration.website_config.website_endpoint<br>}</pre><p>This resource activates website hosting on the bucket and tells S3 which file to serve at the root URL and which file to display when a page is not found.<br>This resource creates a bucket policy that allows anyone on the Internet to read the objects inside the bucket. The depends_on attribute is critical — it tells Terraform to disable the public access block first before applying this policy, otherwise AWS would reject it.</p><p>Instead of manually uploading files through the AWS Console, Terraform uploads the HTML files directly from your local machine to the S3 bucket as part of the apply process.</p><pre>resource &quot;aws_s3_object&quot; &quot;index_html&quot; {<br>  bucket       = aws_s3_bucket.website_bucket.id<br>  key          = &quot;index.html&quot;<br>  source       = &quot;website/index.html&quot;<br>  content_type = &quot;text/html&quot;<br>}<br><br>resource &quot;aws_s3_object&quot; &quot;error_html&quot; {<br>  bucket       = aws_s3_bucket.website_bucket.id<br>  key          = &quot;error.html&quot;<br>  source       = &quot;website/error.html&quot;<br>  content_type = &quot;text/html&quot;<br>}</pre><h4>6- Initialize Terraform</h4><blockquote>Run the following command in your terminal inside the project folder. This downloads the AWS provider plugin and sets up everything Terraform needs to work.<br>terraform init</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*0GAkoonAy6NWdBysYbIOSg.png" /></figure><h4>7-Review the Execution Plan</h4><p>Before making any real changes to your AWS account, always run the plan command first. It shows you exactly what Terraform is about to create, modify, or destroy without actually doing it.<br>terraform plan</p><pre>terraform plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1YtGleED_uYOzOpxXn08A.png" /></figure><h4>7-Apply the Configuration:</h4><p>This command builds all the resources defined in your Terraform files inside your real AWS account. Type yes when prompted to confirm and let Terraform do its work.</p><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOCyYuykQXCV4HelNoptDQ.png" /></figure><pre>aws_s3_object.error: Creation complete after 1s [id=my-host157/error.html]<br>aws_s3_object.index: Creation complete after 1s [id=my-host157/index.html]<br>aws_s3_bucket_website_configuration.website_config: Creation complete after 1s [id=my-host157]<br>aws_s3_bucket_policy.bucket_policy: Creation complete after 1s [id=my-host157]<br><br>Apply complete! Resources: 6 added, 0 changed, 0 destroyed.<br><br>Outputs:<br><br>website_url = &quot;my-host157.s3-website-eu-west-1.amazonaws.com&quot;<br>PS D:\AWS S3 Static Website Hosting using Terraform&gt; </pre><h4>10- Access Your Live Website in a Browser:</h4><p>Copy the website URL from the Terraform output or from the S3 Console and open it in any web browser. Your static website is now live and accessible to anyone on the Internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZcpQGcrcPbkHKPOmlwGsA.png" /><figcaption><a href="http://my-host157.s3-website-eu-west-1.amazonaws.com/">http://my-host157.s3-website-eu-west-1.amazonaws.com/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*vukZ0rQDYQbLvtycSov8Bg.png" /></figure><p><strong>11- Destroy All Resources When Done</strong></p><p>When you have finished testing, run the destroy command to remove all the AWS resources Terraform created. This prevents any unnecessary charges on your AWS bill.</p><pre>terraform destroy</pre><p>This project demonstrates the core Infrastructure as Code skills that are highly valued in DevOps, Cloud Engineering, and Site Reliability Engineering roles today.</p><h3>Resources and Further Reading:</h3><ul><li>GitHub Repository: <a href="https://github.com/Hamza844/AWS-S3-Static-Website-Hosting-using-Terraform">AWS-S3-Static-Website-Hosting-using-Terraform</a></li><li>Terraform AWS Provider Documentation: <a href="https://registry.terraform.io/providers/hashicorp/aws/latest">registry.terraform.io</a></li><li>AWS S3 Static Website Hosting Guide: <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html">docs.aws.amazon.com</a></li><li>Terraform Getting Started on AWS: <a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started">developer.hashicorp.com</a></li></ul><h3>Found This Helpful?</h3><p>Give the GitHub repository a star, connect with me on LinkedIn, and drop a comment below. I share DevOps projects, tips, and career insights regularly. Keep building. Keep automating. Keep growing.<br>Linkedin: <a href="https://www.linkedin.com/in/hamza-ejaz-619764292">https://www.linkedin.com/in/hamza-ejaz-619764292</a><br>Portfolio: <a href="https://portfolio-n03kx79k3-hamza844s-projects.vercel.app/">https://portfolio-n03kx79k3-hamza844s-projects.vercel.app</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f1fee192b7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create an S3 Bucket and Migrate Data Using aws s3 sync]]></title>
            <link>https://medium.com/@hamza46/create-an-s3-bucket-and-migrate-data-using-aws-s3-sync-d5f3ecafe511?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5f3ecafe511</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-cli]]></category>
            <category><![CDATA[cloud-computing-services]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 13:09:01 GMT</pubDate>
            <atom:updated>2026-02-06T13:09:01.483Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Cloud Engineer Guide: Creating an S3 Bucket with AWS CLI and Migrating Data Using Sync</h3><h3>Introduction</h3><p>In real-world cloud environments, engineers frequently need to create new storage buckets and migrate existing data safely and efficiently. Amazon S3 combined with AWS CLI provides a powerful and scriptable way to perform these operations without using the AWS Console.</p><p>In this hands-on guide, I will demonstrate how to:</p><ul><li>Create a new private S3 bucket using AWS CLI</li><li>Inspect an existing S3 bucket</li><li>Migrate all data to a new bucket</li><li>Use the <strong>sync method</strong> for efficient and repeatable data transfer</li><li>Verify data consistency after migration</li></ul><p>This workflow reflects a practical Cloud/DevOps engineering task used in real production scenarios.</p><h3>Prerequisites</h3><p>Before starting, make sure you have:</p><ul><li>AWS CLI installed</li><li>AWS CLI configured (aws configure)</li><li>Valid IAM permissions for S3 (ListBucket, GetObject, PutObject)</li><li>Source bucket already available</li></ul><p>Check configuration:</p><pre>aws sts get-caller-identity</pre><h3>Step 1 — List Existing S3 Buckets</h3><p>First, verify your available buckets.</p><pre>aws s3 ls</pre><p>Example output:</p><pre>2026-02-06 12:27:25 nautilus-s3-9448</pre><h3>Step 2 — Inspect Source Bucket Data</h3><p>List objects inside the source bucket:</p><pre>aws s3 ls s3://nautilus-s3-9448</pre><p>Recursive listing (recommended for full visibility):</p><pre>aws s3 ls s3://nautilus-s3-9448 --recursive</pre><p>This confirms what data will be migrated.</p><h3>Step 3 — Create a New Private S3 Bucket Using AWS CLI</h3><p>Create the destination bucket in the same region.</p><pre>aws s3 mb s3://nautilus-sync-545 --region us-east-1</pre><p>Verify bucket creation:</p><pre>aws s3 ls</pre><h3>Step 4 — Ensure Bucket is Private (Security Best Practice)</h3><p>By default, S3 buckets are private. Still, production practice is to explicitly block public access.</p><pre>aws s3api put-public-access-block \<br>  --bucket nautilus-sync-545 \<br>  --public-access-block-configuration \<br>  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true</pre><h3>Step 5 — Migrate Data Using the Sync Method</h3><p>Instead of copying files blindly, Cloud Engineers use <strong>sync</strong> to copy only missing or changed files.</p><pre>aws s3 sync s3://nautilus-s3-9448 s3://nautilus-sync-545</pre><h3>Why sync instead of cp?</h3><ul><li>Copies only new or modified files</li><li>Faster for large datasets</li><li>Safe to rerun</li><li>Reduces transfer cost</li><li>Suitable for automation pipelines</li></ul><h3>Step 6 — Mirror Mode (Optional)</h3><p>If you want the destination bucket to be an exact mirror of the source, including deleting extra files:</p><pre>aws s3 sync s3://nautilus-s3-9448 s3://nautilus-sync-545 --delete</pre><p>Use this carefully in production.</p><h3>Step 7 — Verify Data Consistency</h3><p>After migration, verify that both buckets contain the same number of objects.</p><p>Count source objects:</p><pre>aws s3 ls s3://nautilus-s3-9448 --recursive | wc -l</pre><p>Count destination objects:</p><pre>aws s3 ls s3://nautilus-sync-545 --recursive | wc -l</pre><h3>Step 8 — Verify Total Size and Summary</h3><pre>aws s3 ls s3://nautilus-s3-9448 --recursive --summarize</pre><pre>aws s3 ls s3://nautilus-sync-545 --recursive --summarize</pre><p>Compare:</p><ul><li>Total Objects</li><li>Total Size</li></ul><p>Both values should match.</p><h3>Real-World Use Cases</h3><p>This method is commonly used for:</p><ul><li>Production bucket migration</li><li>Backup bucket creation</li><li>Environment cloning</li><li>Static website deployments</li><li>Disaster recovery preparation</li><li>CI/CD artifact replication</li></ul><h3>Key Cloud Engineer Takeaways</h3><ul><li>AWS CLI enables fully scriptable S3 operations</li><li>aws s3 sync is preferred for safe and repeatable migrations</li><li>Always verify object count and size after migration</li><li>Block public access unless explicitly required</li><li>Sync operations are idempotent and automation-friendly</li></ul><h3>Conclusion</h3><p>Using AWS CLI to create S3 buckets and migrate data with the sync method is a core operational skill for Cloud and DevOps Engineers. It allows safe, fast, and repeatable data movement across environments without relying on the console.</p><p>This hands-on approach is suitable for real infrastructure workflows and production-ready automation.</p><p><strong>Author:</strong> Hamza Ejaz</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5f3ecafe511" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Deployed a Production-Grade MERN Application with Complete CI/CD Automation]]></title>
            <link>https://medium.com/@hamza46/deployed-a-production-grade-mern-application-with-complete-ci-cd-automation-5d33eaffa796?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d33eaffa796</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 19:24:03 GMT</pubDate>
            <atom:updated>2025-11-17T19:24:03.991Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1epmdZshIjw5Q4iA5tERw.png" /></figure><p># Building a Production-Grade MERN Application with Complete CI/CD Automation</p><p>## From Code Commit to Production in Minutes: A Complete DevOps Journey</p><p>![Header Image Suggestion: Pipeline diagram or Kubernetes dashboard]</p><p>In today’s fast-paced development environment, the ability to deploy code quickly, safely, and reliably is crucial. In this article, I’ll walk you through how I built and deployed a scalable 3-tier chat application with a fully automated DevOps pipeline that transforms code commits into production deployments seamlessly.</p><p>## Table of Contents<br>1. [Project Overview](#overview)<br>2. [Technical Architecture](#architecture)<br>3. [The CI/CD Pipeline](#pipeline)<br>4. [Implementation Deep Dive](#implementation)<br>5. [Challenges and Solutions](#challenges)<br>6. [Results and Impact](#impact)<br>7. [Lessons Learned](#lessons)</p><p>— -</p><p>## Project Overview {#overview}</p><p>This project demonstrates a complete end-to-end DevOps implementation for a MERN stack chat application. The goal was to create a production-ready system where developers can focus on code while the infrastructure handles everything from testing to deployment automatically.</p><p>**What makes this special?**<br>- Zero manual intervention from commit to production<br>- Security scanning at every stage<br>- Code quality enforcement<br>- Zero-downtime deployments<br>- Complete observability</p><p>— -</p><p>## Technical Architecture {#architecture}</p><p>### Application Stack</p><p>**Frontend:**<br>- React.js for dynamic user interface<br>- Responsive design for cross-platform compatibility</p><p>**Backend:**<br>- Node.js runtime environment<br>- Express.js framework for RESTful API<br>- WebSocket integration for real-time chat functionality</p><p>**Database:**<br>- MongoDB for flexible, document-based data storage<br>- Optimized for real-time messaging patterns</p><p>### Infrastructure Stack</p><p>**Containerization:**<br>- Docker for application packaging<br>- Multi-stage builds for optimized image sizes<br>- Docker Hub for container registry</p><p>**Orchestration:**<br>- Kubernetes for container orchestration<br>- Helm charts for declarative deployments<br>- ConfigMaps and Secrets for configuration management</p><p>**CI/CD:**<br>- Jenkins for pipeline automation<br>- Declarative pipeline syntax<br>- Webhook-triggered builds</p><p>**Security &amp; Quality:**<br>- SonarQube for code quality analysis<br>- Trivy for vulnerability scanning<br>- Quality Gates for automated enforcement</p><p>— -</p><p>## The Automated Pipeline Flow {#pipeline}</p><p>Every code commit triggers a comprehensive, automated workflow:</p><p>### 1. **Developer Commits Code** 💻<br>Developers push changes to the GitHub repository, triggering the entire pipeline automatically.</p><p>### 2. **Version Control** 📚<br>GitHub webhook notifies Jenkins of the new commit, initiating the build process.</p><p>### 3. **Automated Build &amp; Test** 🔨<br>Jenkins pulls the latest code and runs:<br>- Dependency installation<br>- Unit tests<br>- Integration tests<br>- Build verification</p><p>### 4. **Code Quality Analysis** 📊<br>SonarQube analyzes the code for:<br>- Code smells<br>- Bugs and vulnerabilities<br>- Code coverage<br>- Maintainability metrics<br>- Technical debt assessment</p><p>**Quality Gate enforcement:** If code doesn’t meet the defined standards, the pipeline stops here.</p><p>### 5. **Security Vulnerability Scanning** 🛡️<br>Trivy scans for:<br>- Known CVEs in dependencies<br>- Misconfiguration issues<br>- Secret exposure<br>- License compliance</p><p>### 6. **Docker Containerization** 🐳<br>- Multi-stage Docker builds create optimized images<br>- Images are tagged with build numbers and commit SHAs<br>- Automated image size optimization</p><p>### 7. **Registry Deployment** 📦<br>Verified images are pushed to Docker Hub:<br>- `hamza844/mernchat-app:latest`<br>- `hamza844/mernchat-app:&lt;version-tag&gt;`</p><p>### 8. **Kubernetes Deployment** ☸️<br>Helm charts deploy the application:<br>- Rolling update strategy<br>- Health checks and readiness probes<br>- Zero-downtime deployment<br>- Automatic rollback on failure</p><p>— -</p><p>## Implementation Deep Dive {#implementation}</p><p>### Jenkins Pipeline Configuration</p><p>```groovy<br>pipeline {<br> agent any<br> <br> environment {<br> DOCKER_IMAGE = ‘hamza844/mernchat-app’<br> KUBE_NAMESPACE = ‘production’<br> }<br> <br> stages {<br> stage(‘Checkout’) {<br> steps {<br> git branch: ‘main’, <br> url: ‘<a href="https://github.com/Hamza844/mern-chat-app.k8s&#39;">https://github.com/Hamza844/mern-chat-app.k8s’</a><br> }<br> }<br> <br> stage(‘Install Dependencies’) {<br> steps {<br> sh ‘npm install’<br> }<br> }<br> <br> stage(‘Run Tests’) {<br> steps {<br> sh ‘npm test’<br> }<br> }<br> <br> stage(‘SonarQube Analysis’) {<br> steps {<br> withSonarQubeEnv(‘SonarQube’) {<br> sh ‘sonar-scanner’<br> }<br> }<br> }<br> <br> stage(‘Quality Gate’) {<br> steps {<br> timeout(time: 1, unit: ‘HOURS’) {<br> waitForQualityGate abortPipeline: true<br> }<br> }<br> }<br> <br> stage(‘Build Docker Image’) {<br> steps {<br> sh “docker build -t ${DOCKER_IMAGE}:${BUILD_NUMBER} .”<br> sh “docker tag ${DOCKER_IMAGE}:${BUILD_NUMBER} ${DOCKER_IMAGE}:latest”<br> }<br> }<br> <br> stage(‘Trivy Security Scan’) {<br> steps {<br> sh “trivy image ${DOCKER_IMAGE}:${BUILD_NUMBER}”<br> }<br> }<br> <br> stage(‘Push to Docker Hub’) {<br> steps {<br> withCredentials([usernamePassword(credentialsId: ‘dockerhub’, <br> usernameVariable: ‘USER’, <br> passwordVariable: ‘PASS’)]) {<br> sh “docker login -u $USER -p $PASS”<br> sh “docker push ${DOCKER_IMAGE}:${BUILD_NUMBER}”<br> sh “docker push ${DOCKER_IMAGE}:latest”<br> }<br> }<br> }<br> <br> stage(‘Deploy to Kubernetes’) {<br> steps {<br> sh “””<br> helm upgrade — install mernchat-app ./helm/mernchat \<br> — set image.tag=${BUILD_NUMBER} \<br> — namespace ${KUBE_NAMESPACE}<br> “””<br> }<br> }<br> }<br> <br> post {<br> success {<br> echo ‘Pipeline completed successfully!’<br> }<br> failure {<br> echo ‘Pipeline failed!’<br> }<br> }<br>}<br>```</p><p>### Dockerfile Optimization</p><p>```dockerfile<br># Multi-stage build for optimized image size</p><p># Stage 1: Build<br>FROM node:18-alpine AS builder<br>WORKDIR /app<br>COPY package*.json ./<br>RUN npm ci — only=production<br>COPY . .<br>RUN npm run build</p><p># Stage 2: Production<br>FROM node:18-alpine<br>WORKDIR /app<br>COPY — from=builder /app/dist ./dist<br>COPY — from=builder /app/node_modules ./node_modules<br>COPY package*.json ./<br>EXPOSE 3000<br>USER node<br>CMD [“npm”, “start”]<br>```</p><p>### Helm Chart Structure</p><p>```yaml<br># values.yaml<br>replicaCount: 3</p><p>image:<br> repository: hamza844/mernchat-app<br> pullPolicy: IfNotPresent<br> tag: “latest”</p><p>service:<br> type: LoadBalancer<br> port: 80<br> targetPort: 3000</p><p>resources:<br> limits:<br> cpu: 500m<br> memory: 512Mi<br> requests:<br> cpu: 250m<br> memory: 256Mi</p><p>autoscaling:<br> enabled: true<br> minReplicas: 2<br> maxReplicas: 10<br> targetCPUUtilizationPercentage: 80</p><p>livenessProbe:<br> httpGet:<br> path: /health<br> port: 3000<br> initialDelaySeconds: 30<br> periodSeconds: 10</p><p>readinessProbe:<br> httpGet:<br> path: /ready<br> port: 3000<br> initialDelaySeconds: 5<br> periodSeconds: 5<br>```</p><p>— -</p><p>## Challenges and Solutions {#challenges}</p><p>### Challenge 1: Managing Secrets Securely<br>**Problem:** Storing sensitive credentials (database passwords, API keys) securely.</p><p>**Solution:** <br>- Kubernetes Secrets for sensitive data<br>- Jenkins credential management<br>- Environment-specific configurations<br>- No hardcoded credentials in code</p><p>### Challenge 2: Zero-Downtime Deployments<br>**Problem:** Ensuring continuous availability during updates.</p><p>**Solution:**<br>- Kubernetes rolling update strategy<br>- Health checks and readiness probes<br>- Multiple replicas with proper pod distribution<br>- Automated rollback on failure</p><p>### Challenge 3: Build Time Optimization<br>**Problem:** Initial pipeline took 15+ minutes per build.</p><p>**Solution:**<br>- Docker layer caching<br>- Multi-stage builds<br>- Parallel test execution<br>- Optimized dependency installation</p><p>### Challenge 4: Security Scanning False Positives<br>**Problem:** Trivy flagged numerous false positives, blocking deployments.</p><p>**Solution:**<br>- Configured severity thresholds<br>- Maintained allowlist for known safe issues<br>- Regular updates to scanning databases<br>- Balanced security with practicality</p><p>— -</p><p>## Results and Impact {#impact}</p><p>### Quantitative Improvements</p><p>| Metric | Before | After | Improvement |<br>| — — — — | — — — — | — — — -| — — — — — — -|<br>| Deployment Time | 2+ hours | 8 minutes | **93% faster** |<br>| Manual Steps | 15+ | 0 | **100% automated** |<br>| Deployment Errors | ~20% | &lt;1% | **95% reduction** |<br>| Code Quality Score | N/A | 85%+ | **Measurable quality** |<br>| Security Vulnerabilities | Unknown | Tracked &amp; resolved | **Proactive security** |</p><p>### Qualitative Benefits</p><p>✅ **Developer Experience:** Developers focus on features, not deployment <br>✅ **Reliability:** Consistent, repeatable deployment process <br>✅ **Security:** Automated scanning catches issues early <br>✅ **Observability:** Complete visibility into deployment status <br>✅ **Scalability:** Infrastructure handles increased load automatically</p><p>— -</p><p>## Lessons Learned {#lessons}</p><p>### 1. **Start with Automation in Mind**<br>Building CI/CD from the beginning is easier than retrofitting it later.</p><p>### 2. **Security Cannot Be an Afterthought**<br>Integrating security scanning early prevents vulnerabilities from reaching production.</p><p>### 3. **Quality Gates Are Essential**<br>Automated quality enforcement maintains codebase health without manual reviews.</p><p>### 4. **Documentation Matters**<br>Clear documentation of pipeline stages helps troubleshooting and onboarding.</p><p>### 5. **Monitor Everything**<br>Comprehensive logging and monitoring are crucial for production systems.</p><p>— -</p><p>## What’s Next?</p><p>This project demonstrates the power of modern DevOps practices, but there’s always room for improvement:</p><p>🔮 **Future Enhancements:**<br>- GitOps with ArgoCD for declarative deployments<br>- Service mesh integration (Istio/Linkerd)<br>- Advanced monitoring with Prometheus and Grafana<br>- Automated testing with Selenium/Cypress<br>- Multi-cloud deployment strategies</p><p>— -</p><p>## Explore the Project</p><p>Want to see the code and try it yourself?</p><p>📂 **GitHub Repository:** [github.com/Hamza844/mern-chat-app.k8s](<a href="https://github.com/Hamza844/mern-chat-app.k8s">https://github.com/Hamza844/mern-chat-app.k8s</a>) <br>🐳 **Docker Hub:** [hamza844/mernchat-app](<a href="https://hub.docker.com/r/hamza844/mernchat-app">https://hub.docker.com/r/hamza844/mernchat-app</a>)</p><p>— -</p><p>## Let’s Connect!</p><p>I’m currently seeking **DevOps Engineer**, **Cloud Infrastructure Engineer**, or **SRE** roles where I can build scalable, automated systems and drive infrastructure excellence.</p><p>💼 Open to opportunities where automation and continuous delivery are valued.</p><p>📧 Feel free to reach out if you’d like to discuss DevOps, cloud infrastructure, or potential opportunities!</p><p>— -</p><p>## Final Thoughts</p><p>Building this CI/CD pipeline taught me that DevOps is more than just tools — it’s a culture of automation, collaboration, and continuous improvement. The investment in infrastructure automation pays dividends in developer productivity, code quality, and system reliability.</p><p>**What’s your approach to CI/CD?** Share your experiences in the comments below!</p><p>— -</p><p>*If you found this article helpful, please give it a clap 👏 and share it with others who might benefit from it!*</p><p>**Tags:** #DevOps #Kubernetes #Docker #Jenkins #CICD #CloudEngineering #Automation #MERN #InfrastructureAsCode #SonarQube #Trivy #Helm #CloudNative #SoftwareEngineering</p><p>— -</p><p>*Article by Hamza | DevOps Engineer | Building scalable, automated infrastructure*</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d33eaffa796" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Successfully Deployed a Full-Stack Laravel App Using Kubernetes, Docker, and MySQL]]></title>
            <link>https://medium.com/@hamza46/successfully-deployed-a-full-stack-laravel-app-using-kubernetes-docker-and-mysql-4a1a74893ba4?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a1a74893ba4</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Wed, 29 Oct 2025 04:36:34 GMT</pubDate>
            <atom:updated>2025-10-29T04:36:34.923Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I worked on deploying a <strong>full-stack Laravel application</strong> using <strong>Kubernetes</strong>, <strong>Docker</strong>, and <strong>MySQL</strong> — focusing on container orchestration, init containers, and persistent storage.</p><p>This project was a great hands-on opportunity to explore how containerized microservices communicate, scale, and stay resilient under real-world workloads.</p><h4>🧩 Technical Implementation</h4><p>Here’s a quick overview of the key steps involved:</p><ul><li><strong>Containerized a Laravel App</strong> for a clean and isolated deployment</li><li><strong>Deployed MySQL 8.0</strong> as a StatefulSet for persistent data management</li><li><strong>Configured dynamic storage provisioning</strong> with PersistentVolumeClaims</li><li><strong>Implemented Init Containers</strong> for database migration tasks</li><li><strong>Established secure communication</strong> between application and database pods</li><li><strong>Set up headless services</strong> for internal DNS resolution</li><li><strong>Exposed services via NodePort</strong> for external access</li></ul><h3>⚙️ Key Challenges &amp; Solutions</h3><p>During the process, I faced (and solved) a few interesting challenges:</p><ul><li>PersistentVolumeClaim binding issues → resolved by fine-tuning storage class configs</li><li>Pod scheduling failures → fixed through better resource requests/limits</li><li>Database connection management → handled through environment variables and secrets</li></ul><p>These fixes not only improved performance but also taught me how important observability and logging are in Kubernetes-based deployments.</p><h3>💭 Lessons Learned</h3><ul><li><strong>Automation is everything.</strong> Manual fixes cost time; scripts save you.</li><li><strong>Monitoring is key.</strong> Metrics and logs should always tell a story.</li><li><strong>Containers are powerful — but orchestration makes them magical.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pDFgzWe5Zrhk9iUj4SfD8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6TpLBiziJtcbgzDjPQOMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6vBt2TZnwTUJPpHFTMFIw.png" /></figure><h4>🤝 Let’s Connect!</h4><p>I’m currently <strong>open to new DevOps or Cloud Engineering opportunities</strong> where I can contribute to scalable systems, automation, and infrastructure reliability.</p><p>If you’re working on similar projects or have an opening, feel free to connect or reach out!</p><p>https://www.linkedin.com/posts/hamza-ejaz-619764292_devops-kubernetes-docker-activity-7388439331914420224-A7Oz?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAAEbyeHUBpPVlZ95CgNd29bwLoMkxjLsxAaw</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a1a74893ba4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Web Application on Docker Swarm]]></title>
            <link>https://medium.com/@hamza46/deploying-a-web-application-on-docker-swarm-f25c7f996987?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f25c7f996987</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cicd]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 09:49:18 GMT</pubDate>
            <atom:updated>2025-10-28T09:49:18.414Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*S9_22dnS9bSXuenuEjd-Zw.png" /></figure><p><em>Building Production-Ready Docker Containers for Modern Web Applications</em></p><p>As a DevOps engineer, I recently containerized an AI-generated crypto trading platform and deployed it to production using Docker Swarm. This post covers the technical implementation, challenges solved, and best practices for containerizing modern React applications at scale.</p><p>Before we proceed, let’s get some basic understanding of Docker Swarm as an orchestration tool.</p><p><strong>What is Docker Swarm?<br></strong>Docker Swarm is a container orchestration tool that facilitates the management and deployment of containerized applications. It extends the capabilities of Docker containers to a clustered environment, allowing organizations to scale their applications seamlessly. Docker Swarm enables the creation of a swarm, a group of Docker hosts, for deploying and managing containers across multiple nodes.</p><p><strong>Key Features of Docker Swarm:</strong></p><p><strong>Orchestration:</strong> Docker Swarm provides orchestration capabilities, allowing users to define and manage complex multi-container applications effortlessly. It automates the deployment, scaling, and maintenance of containerized applications, ensuring efficient resource utilization.<br><strong>Scalability:</strong> One of the significant advantages of Docker Swarm is its ability to scale applications horizontally. As the demand for resources increases, additional nodes can be added to the swarm, distributing the workload, and improving application performance.<br><strong>High Availability:</strong> Docker Swarm ensures high availability by distributing containers across multiple nodes. In the event of a node failure, the swarm automatically reschedules containers to healthy nodes, minimizing downtime and enhancing application reliability.<br><strong>Load Balancing:</strong> Load balancing is a crucial aspect of managing containerized applications. Docker Swarm includes an integrated load balancer that distributes incoming traffic among the containers within the swarm, optimizing resource utilization and improving overall application performance.<br><strong>Service Discovery:</strong> Service discovery in Docker Swarm is simplified, allowing containers to communicate with each other seamlessly. Each service within the swarm is assigned a DNS name, making it easy for containers to discover and connect to other services.<br><strong>Security:</strong> Docker Swarm provides robust security features, including built-in support for Transport Layer Security (TLS) to encrypt communication between nodes. Additionally, access control mechanisms and role-based authentication contribute to creating a secure containerized environment.</p><p><strong>Step 1: Local Docker Image Creation &amp; Registry Publishing</strong></p><p><em>Repository</em>: <a href="https://github.com/Hamza844/crypto-trade">https://github.com/Hamza844/crypto-trade</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9nZ_JCbwGkK2RIVshrB7mQ.png" /></figure><p>I have created a Dockerfile, and here is where you can practice on this….</p><pre>FROM node:alpine<br>WORKDIR /app<br>COPY package*.json ./<br>RUN npm install<br>COPY . .<br>RUN npm run build<br>EXPOSE 3000<br>CMD [&quot;npm&quot;, &quot;start&quot;]</pre><p><strong>Key Technical Decisions:</strong></p><ul><li><strong>Base Image</strong>: node: alpine — Chosen for its lightweight footprint while maintaining full Node.js compatibility</li><li><strong>Port Configuration</strong>: Exposed port 3000 for web traffic</li><li><strong>Working Directory</strong>: Organized under /app for a clean container structure</li></ul><pre>docker build -t crypto_trade.<br>docker tag crypto_trade hamza844/crypto_trade:latest<br>docker push hamza844/crypto_trade:latest</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f25c7f996987" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Best Ways to Optimize Kubernetes Resources and Reduce Costs]]></title>
            <link>https://medium.com/@hamza46/5-best-ways-to-optimize-kubernetes-resources-and-reduce-costs-11b96b25d3a6?source=rss-ee4d65e7e94b------2</link>
            <guid isPermaLink="false">https://medium.com/p/11b96b25d3a6</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[aws-eks]]></category>
            <category><![CDATA[persistent-volume]]></category>
            <category><![CDATA[sre]]></category>
            <dc:creator><![CDATA[Cloud with Hamza]]></dc:creator>
            <pubDate>Sat, 18 Oct 2025 10:43:34 GMT</pubDate>
            <atom:updated>2025-10-18T10:43:34.986Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*VGzKMW4kHdZ4qiE1cEJSlQ.png" /></figure><p>Kubernetes has become the de facto standard for container orchestration, offering a powerful platform for deploying, scaling, and managing containerized applications. However, as organizations scale their Kubernetes deployments, managing costs and optimizing resource allocations become critical challenges. For cloud engineering executives and engineering leaders, ensuring efficient Kubernetes operation without overspending requires strategic planning and the implementation of best practices. This blog post outlines five effective strategies to optimize Kubernetes costs and resources, ensuring your deployments run efficiently and economically.</p><h4>1. Implementing Cluster Autoscaling:</h4><p><a href="https://github.com/kubernetes/autoscaler">Cluster autoscaling</a> dynamically adjusts the number of nodes in your cluster to meet the needs of your workloads. By scaling your cluster in and out based on demand, you can ensure that you’re only paying for the resources you actually need.<br><strong>Code Example: Implementing Cluster Autoscaler on AWS EKS yaml Copy code</strong></p><pre>apiVersion: autoscaling/v1<br>kind: HorizontalPodAutoscaler<br>metadata:<br>  name: example-application-autoscaler<br>  namespace: default<br>spec:<br>  scaleTargetRef:<br>    apiVersion: apps/v1<br>    kind: Deployment<br>    name: example-application<br>  minReplicas: 3<br>  maxReplicas: 10<br>  targetCPUUtilizationPercentage: 50</pre><p>This YAML configuration file creates a Horizontal Pod Autoscaler for an application, ensuring that it scales out when the CPU utilization goes above 50% and scales in when the usage drops, between a minimum of 3 and a maximum of 10 replicas.</p><h4>2. Optimizing Container Resource Requests and Limits:</h4><p>Kubernetes allows you to specify CPU and memory (RAM) requests and limits for each container. Properly configuring these parameters ensures that your applications have enough resources to run efficiently while preventing them from consuming excessive resources.</p><p><strong>Code Example: Setting Resource Requests and Limits</strong></p><pre>yamlCopy coapiVersion: v1<br>kind: Pod<br>metadata:<br>  name: example-pod<br>spec:<br>  containers:<br>  - name: example-container<br>    image: example/image<br>    resources:<br>      requests:<br>        memory: &quot;256Mi&quot;<br>        cpu: &quot;500m&quot;<br>      limits:<br>        memory: &quot;512Mi&quot;<br>        cpu: &quot;1000m&quot;</pre><p>This configuration specifies that the container needs at least 256Mi of memory and 0.5 CPU cores to run. It also sets limits at 512Mi of memory and 1 CPU core to prevent the container from using more than its fair share of resources.</p><h4>3. Rightsizing Workloads:</h4><p>Rightsizing involves analyzing the resource utilization of your workloads and adjusting their allocations to better match their actual needs. Over-provisioned workloads waste money, while under-provisioned workloads may lead to performance issues.<br><strong>Tools and Practices:</strong></p><ul><li>Use monitoring tools like Prometheus and Grafana to gather data on resource usage.</li><li>Regularly review resource metrics and adjust requests and limits accordingly.</li></ul><h4>4. Utilize Pod Disruption Budgets:</h4><p>Pod Disruption Budgets (PDBs) help ensure that a minimum number of pods are available during voluntary disruptions, such as node maintenance. This ensures high availability without over-provisioning resources</p><p><strong>Code Example: Pod Disruption Budget</strong></p><pre>apiVersion: policy/v1<br>kind: PodDisruptionBudget<br>metadata:<br>  name: example-pdb<br>spec:<br>  minAvailable: 2<br>  selector:<br>    matchLabels:<br>      app: example-app</pre><p>This PDB ensures that at least two instances of example-app are always available, preventing over-scaling while maintaining availability.</p><h4>5. Implementing Namespace Quotas and Limits:</h4><p>By setting quotas and limits at the namespace level, you can control resource allocation and usage across different teams or projects, preventing any single team from consuming more than its fair share of resources.</p><p><strong>Code Example: Setting a Namespace Resource Quota</strong></p><pre>apiVersion: v1<br>kind: ResourceQuota<br>metadata:<br>  name: team-a-quota<br>  namespace: team-a<br>spec:<br>  hard:<br>    requests.cpu: &quot;10&quot;<br>    requests.memory: 20Gi<br>    limits.cpu: &quot;20&quot;<br>    limits.memory: 40Gi</pre><p>This configuration limits the total amount of CPU and memory resources that can be requested or limited by all pods in the team-a namespace, ensuring fair resource distribution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11b96b25d3a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>