In today’s cloud-native world, Kubernetes has emerged as a go-to platform for container orchestration, and Helm simplifies application deployment by packaging Kubernetes YAML configurations into reusable charts. Deploying applications like Vue.js (frontend) and Java (backend) on AWS Elastic Kubernetes Service (EKS) using Helm enables scalability, ease of management, and robustness.

This guide will cover deploying Vue.js and Java applications on AWS EKS with Helm, from development to cleanup.

Introduction to Kubernetes and Helm

Kubernetes, or K8s, is a container orchestration platform that automates containerized applications’ deployment, scaling, and management. Helm acts as a package manager for Kubernetes, simplifying the deployment process by bundling multiple Kubernetes YAML files into a single chart.

Why Use Helm on EKS?

  • Simplifies application deployment and rollback.
  • Centralizes configuration management.
  • Supports scalable, cloud-native application architecture.

Setting Up the Development Environment

Before diving in, ensure you have the following tools installed:

  • Docker: For containerizing applications.
  • AWS CLI: To interact with AWS services.
  • kubectl: For Kubernetes cluster management.
  • Helm: To manage Kubernetes applications.
  • eksctl: To create and manage EKS clusters.

Step 1: Configure AWS CLI

aws configure

Provide your AWS Access Key, Secret Key, region, and output format.

Step 2: Install kubectl, eksctl, and Helm

Follow the respective installation guides for your operating system:

  • Install kubectl
  • Install eksctl
  • Install Helm

Dockerizing the Vue.js and Java Project

Step 1: Create Dockerfiles

Vue.js Dockerfile:

# Vue.js Dockerfile

FROM node:16-alpine as build

WORKDIR /app

COPY package.json yarn.lock ./

RUN yarn install

COPY . .

RUN yarn build

FROM nginx:alpine

COPY –from=build /app/dist /usr/share/nginx/html

EXPOSE 80

CMD [“nginx”, “-g”, “daemon off;”]

Java Spring Boot Dockerfile:

# Java Dockerfile

FROM openjdk:17-jdk-slim

ARG JAR_FILE=target/*.jar

COPY ${JAR_FILE} app.jar

ENTRYPOINT [“java”, “-jar”, “/app.jar”]

Step 2: Build Docker Images

docker build -t vue-app:latest ./vue

docker build -t java-app:latest ./java

Storing Docker Images in Amazon ECR

  • Create Amazon ECR Repositories:

aws ecr create-repository –repository-name vue-app

aws ecr create-repository –repository-name java-app

  1. Login to ECR:
    aws ecr get-login-password –region <region> | docker login –username AWS –password-stdin <account_id>.dkr.ecr.<region>.amazonaws.com
  2. Push Docker Images:
    docker tag vue-app:latest <account_id>.dkr.ecr.<region>.amazonaws.com/vue-app:latest

docker push <account_id>.dkr.ecr.<region>.amazonaws.com/vue-app:latest

docker tag java-app:latest <account_id>.dkr.ecr.<region>.amazonaws.com/java-app:latest

docker push <account_id>.dkr.ecr.<region>.amazonaws.com/java-app:latest

Building a Helm Chart for Deployment

Step 1: Create Helm Chart

helm create vue-java-app

Step 2: Modify Templates

Deployment Template (templates/deployment.yaml): Include configurations for Vue.js and Java applications.

Values File (values.yaml): Define values such as image URLs, replicas, and resource limits.

Step 3: Package the Chart

helm package vue-java-app

Setting Up AWS EKS Cluster and Worker Nodes

  1. Create an EKS Cluster:
    eksctl create cluster –name vue-java-cluster –region <region> –nodes 3
  2. Verify Cluster Setup:
    kubectl get nodes

Installing the Helm Chart on EKS

  1. Add Helm Chart to Repository:
    helm repo add vue-java-repo ./vue-java-app

helm repo update

  1. Install the Helm Chart:
    helm install vue-java-release vue-java-repo –namespace default
  2. Verify Deployment:
    kubectl get pods

Accessing the Deployed Application

Expose the services using a LoadBalancer or Ingress.

Check LoadBalancer Service:

kubectl get svc

Access the frontend via the LoadBalancer URL for Vue.js and backend APIs for the Java application.

Cleaning Up Resources

  1. Delete Helm Release:
    helm uninstall vue-java-release
  2. Delete EKS Cluster:
    eksctl delete cluster –name vue-java-cluster
  3. Delete ECR Repositories:
    aws ecr delete-repository –repository-name vue-app –force

aws ecr delete-repository –repository-name java-app –force

Conclusion

Deploying Vue.js and Java applications on AWS EKS using Helm streamlines application management and ensures scalability. This guide walked you through the entire process, from Dockerizing the applications to deploying and managing them on EKS.

References

Deploy applications with Helm on Amazon EKS

Deploy a sample Java microservice on Amazon EKS and expose the microservice using an Application Load Balancer