DevOps configurations and deployment tools for the ksau-web-backend application on Kubernetes.
Before deploying the application, ensure you have the following:
- AWS Account with appropriate permissions
- AWS CLI installed and configured
- eksctl installed
- kubectl installed
- Helm v3 installed (for Helm deployment method)
- Access to the Docker image repository (ksauraj/ksau-web-backend)
- Use the provided EKS cluster configuration file:
eksctl create cluster -f eks-cluster-config.yaml
The configuration uses t3.small instances to optimize costs while providing sufficient resources for the application.
This process will take approximately 15-20 minutes to complete.
- Verify that your cluster is created and configured correctly:
kubectl get nodes
- Install the NGINX Ingress Controller using the AWS-specific manifest:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.2/deploy/static/provider/aws/deploy.yaml
- Verify the installation:
kubectl get pods -n ingress-nginx
- Get the External IP/DNS of the NGINX Ingress Controller:
kubectl get service ingress-nginx-controller -n ingress-nginx
The output will include an EXTERNAL-IP field with a value like a1b2c3d4e5f6g7h8i9j0.us-east-1.elb.amazonaws.com
. This is the AWS Load Balancer DNS name that will be used for DNS configuration.
-
Go to your domain registrar's DNS management page.
-
Add a new DNS record:
- Type: CNAME
- Name: aws (or your preferred subdomain)
- Value: The EXTERNAL-IP from the previous step
- TTL: 300 (or as low as possible for faster propagation)
-
Wait for DNS propagation (can take up to 24-48 hours, but often much faster).
If you don't own a domain or want to test quickly, you can use /etc/hosts
file (or Windows equivalent):
-
Edit your hosts file:
- On Linux/Mac:
sudo nano /etc/hosts
- On Windows: Edit
C:\Windows\System32\drivers\etc\hosts
as Administrator
- On Linux/Mac:
-
Add a line with the following format:
<Load Balancer IP> aws.ksauraj.eu.org
-
Save the file.
This method only works for local testing on your machine.
To deploy the application using raw Kubernetes manifests:
# Apply the deployment
kubectl apply -f k8s/manifests/deployment.yaml
# Apply the service
kubectl apply -f k8s/manifests/service.yaml
# Apply the ingress
kubectl apply -f k8s/manifests/ingress.yaml
Verify the deployment:
kubectl get deployments,services,ingress
To install the chart with the release name my-release
:
# Navigate to the Helm chart directory
cd helm/ksau-web-charts
# Install the chart
helm install my-release .
You can override the default configuration values during installation:
helm install my-release . --set service.type=NodePort --set ingress.host=example.com
Alternatively, you can provide a custom values file:
helm install my-release . -f custom-values.yaml
After installation, verify that the resources have been created:
kubectl get deployments,services,ingress -l app=ksau-web-backend
The following table lists the configurable parameters of the ksau-web-charts chart and their default values:
Parameter | Description | Default |
---|---|---|
labels.app |
Application label | ksau-web-backend |
labels.env |
Environment label | dev |
container.name |
Container name | ksau-web-backend |
container.image.name |
Container image name | ksauraj/ksau-web-backend |
container.image.tag |
Container image tag | v1-alpine |
deployment.name |
Deployment name | ksau-web-backend-svc |
deployment.replicaCount |
Number of replicas | 1 |
service.name |
Service name | ksau-web-backend-svc |
service.type |
Service type | ClusterIP |
service.port |
Service port | 80 |
service.targetPort |
Container port | 8080 |
ingress.name |
Ingress name | ksau-web-backend-ing |
ingress.host |
Ingress host | aws.ksauraj.eu.org |
To modify these parameters, either edit the values.yaml
file or provide your own values file.
Once deployed, the application will be accessible at the URL specified in the ingress configuration:
http://aws.ksauraj.eu.org
To scale the deployment to 3 replicas:
kubectl scale deployment ksau-web-backend --replicas=3
Or if using Helm, update the values.yaml
file and upgrade the release:
helm upgrade my-release . --set deployment.replicaCount=3
To upgrade the chart with a new version or configuration:
helm upgrade my-release .
To remove the resources created with Kubernetes manifests:
kubectl delete -f k8s/manifests/ingress.yaml
kubectl delete -f k8s/manifests/service.yaml
kubectl delete -f k8s/manifests/deployment.yaml
To uninstall/delete the my-release
deployment:
helm uninstall my-release
This will remove all the Kubernetes resources associated with the chart.
-
Verify the NGINX Ingress Controller is running:
kubectl get pods -n ingress-nginx
-
Check the ingress resource:
kubectl describe ingress ksau-web-backend
-
Ensure your DNS is properly configured and has propagated.
-
Check the pod status:
kubectl get pods -l app=ksau-web-backend
-
View the pod logs:
kubectl logs <pod-name>
-
Describe the pod for events:
kubectl describe pod <pod-name>
To delete the EKS cluster when you're done:
eksctl delete cluster --name ksau-cluster --region us-east-1
This will remove all AWS resources created for the cluster, including the load balancer.