Devops for decoupled architecture

Devops for decoupled architecture

Decoupled architecture is when you have frontend and backend in two separate folders, and this is when you design e-commerce application, social media app etc. Below is a hands on tutorial on how you can upload your backend on the internet(https) and make api calls in the real time.


Understanding Docker, Kubernetes, and AWS EKS Like a Pro

Deploying your app to the web might sound intimidating, but trust me—it’s easier than you think once you break it down into bite-sized steps. So grab your coffee ☕, and let’s chat about Docker, Kubernetes, and AWS EKS.


1. Docker: The Travel Suitcase for Your App 🐳

Imagine packing everything your app needs—libraries, dependencies, and configuration—into one tidy suitcase 🎒. That’s Docker in a nutshell.

What is Docker?

Docker is a tool that lets you bundle up your application and everything it needs into containers. These containers ensure your app works anywhere, whether on your laptop or in the cloud.

Key Commands to Get Started:

  • Build a Docker Image:

    docker buildx build --platform linux/amd64 -t myapp/server:latest .
    
    • What’s Happening? You’re creating a neat package of your app (a Docker image) using the Dockerfile. The -t adds a tag (name and version), and --platform linux/amd64 ensures it runs smoothly on most servers.
  • Upload the Docker Image:

    docker push myapp/server:latest
    
    • Why? You’re storing the image in a container registry like Docker Hub. Think of it as uploading your app’s suitcase to a global storage locker 🛅.

2. Kubernetes (K8s): The Master Orchestrator 🚀

Once your app’s in a suitcase (Docker container), someone needs to manage it—like deciding where it runs or what happens if something crashes. That’s Kubernetes’ job.

What is Kubernetes?

Kubernetes, often called K8s, automates deploying, scaling, and managing your app’s containers. It’s like having an orchestra conductor 🎼 ensuring all parts of your app play in harmony.

Must-Know Commands:

  • Deploy Your App:

    kubectl apply -f ingress.yaml  
    kubectl apply -f deployment.yaml -n mynamespace  
    kubectl apply -f service.yaml -n mynamespace
    
    • Translation: These commands tell Kubernetes to create resources based on your YAML files. Think of YAML files as recipes 📝 for what your app needs.
  • Check the Status:

    kubectl get ingress -n mynamespace  
    kubectl get pods -n mynamespace
    
    • Why Do This? It’s like checking the oven to see if your cookies 🍪 are baking properly. You can confirm that everything’s running as expected.

3. AWS EKS: Kubernetes Made Easier ☁️

Setting up your own Kubernetes cluster can be overwhelming. Enter AWS Elastic Kubernetes Service (EKS), which handles most of the heavy lifting so you can focus on your app 🚀.

What is AWS EKS?

AWS EKS is a managed Kubernetes service. It sets up and operates Kubernetes clusters for you, taking care of servers and scaling so you can breathe easier.

Commands to Get You Going:

  • Create a Cluster:

    eksctl create cluster --name my-cluster --region ap-south-1 --fargate
    
    • What It Does: This spins up a Kubernetes cluster in AWS, and Fargate means you don’t even have to worry about managing servers (because who has time for that?).
  • Connect Your Tools to the Cluster:

    aws eks update-kubeconfig --name my-cluster --region ap-south-1
    
    • Think of It As: Adding your new cluster to your toolbox 🔧 so you can manage it with kubectl.
  • Stay Organised with Namespaces:

    kubectl create namespace mynamespace
    
    • Pro Tip: Namespaces are like folders 📂. They help you keep resources for different projects neatly separated.

4. AWS ACM: Securing Your App with HTTPS 🔒

These days, a secure app isn’t optional—it’s a must. AWS Certificate Manager (ACM) helps you handle SSL/TLS certificates, ensuring your app is trustworthy 🔒.

What is AWS ACM?

ACM is a service that simplifies provisioning, managing, and deploying SSL/TLS certificates. No more “Not Secure” warnings scaring off your users!

Key Command to Use:

  • Import an SSL Certificate:
    aws acm import-certificate --certificate fileb://domain.cert.pem --private-key fileb://private.key.pem --certificate-chain fileb://intermediate.cert.pem
    
    • What It Does: This command uploads your certificate to AWS. It’s like putting a lock on your app’s front door 🏡 to keep things secure.

Wrapping Things Up

So there you have it—Docker for packaging your app, Kubernetes for managing it, AWS EKS for simplifying the process, and ACM for locking it all down securely. 🚀

If you’ve made it this far, give yourself a pat on the back 🎉. Deployment might seem like a maze at first, but it’s more like following a treasure map once you know the steps.

  1. Docker: You built and pushed a Docker image of your backend application to Docker Hub.
  2. Kubernetes: You deployed this Docker image to your Kubernetes cluster, configuring services, deployments, and an ingress for external access.
  3. AWS EKS: You set up an AWS EKS cluster using Fargate, configured it, and deployed your Kubernetes resources there.
  4. AWS ACM: You imported an SSL certificate to use HTTPS for secure communication.

These steps are crucial in setting up a scalable, secure, and manageable environment for your application, leveraging cloud-native technologies.

story time:

I had deployed an e-commerce application for billboards(soboards(dot)com) and had done all the things. I had $1,000 in AWS credits, but $195 was being spent every month just to run EKS—without a single user or any traffic. Now, I’m thinking of shutting down this website and starting something new.