Table of contents
This Helm chart simplifies the deployment of an Apache HTTP Server on Kubernetes, ensuring scalability and ease of configuration.
Prerequisites
Before deploying the Apache Helm chart, ensure you have:
A running Kubernetes cluster (local, cloud, or KIND).
kubectl
installed and configured.Helm 3 installed. To install Helm, run:
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 chmod 700 get_helm.sh ./get_helm.sh
Create Chart
The Helm chart is organized as follows:
helm create apache-helm
Chart Structure
The Helm chart is organized as follows:
apache-helm/
├── Chart.yaml # Metadata about the chart
├── values.yaml # Default values for the deployment
└── templates/ # Kubernetes manifests
├── deployment.yaml
└── service.yaml
Installation Steps
1. Clone the Helm Chart
Navigate to the directory containing the Helm chart.
You can override these values by:
Editing
values.yaml
.Using the
--set
flag during installation.
Default Configuration
The deployment uses the default values from values.yaml
:
image:
repository: httpd
tag: 2.4
service:
port: 80
targetPort: 80
2.Package the Chart
Run the following command to package the chart:
helm package apache-helm
3. Install the Helm Chart
Deploy the Apache server with: (for dev and prod environment)
helm install dev-apache apache-helm -n apache-namespace --create-namespace
Similarly Deploy for prod environment :
change Values.yml file
helm install prod-apache apache-helm -n prod-apache --create-namespace
Change Chart.yml file version 1.16.1 for production:
Change values.yml file for replica count 2 for production:
Run the following command to upgrade apache-helm chart:
helm upgrade prod-apache ./apache-helm -n prod-apache
we can see pod replicas running as 2
Roll back :
helm rollback prod-apache 1 -n prod-apache
Accessing the Deployment
Check the Status
kubectl get pods -n dev-apache kubectl get svc -n dev-apache kubectl get pods -n prod-apache kubectl get svc -n prod-apache
Forward the Service Port Forward the Apache service to a local port for access:
sudo -E kubectl port-forward service/dev-apache-apache-helm -n dev-apache 80:80 --address=0.0.0.0
Access Locally Open your browser and visit:
http://ec2-public-ip:80
Uninstallation
To remove the deployment and its resources:
helm uninstall dev-apache -n dev-apache
helm uninstall prod-apache -n prod-apache
kubectl delete namespace dev-apache
kubectl delete namespace prod-apache
Customizing the Chart
You can customize the deployment in two ways:
1. Override Values Using the --set
Flag
helm install apache ./apache \
--namespace apache-namespace \
--set replicaCount=3 \
--set image.tag=2.4.53 \
--set service.type=LoadBalancer
2. Modify the values.yaml
File
Edit the values.yaml
file directly to adjust configurations.
Features
Scalable: Adjust
replicaCount
to scale pods.Configurable Resources: Define CPU/memory requests and limits.
Flexible Service Types: Supports
ClusterIP
,NodePort
, andLoadBalancer
.
Troubleshooting
Verify Versions
helm version kubectl version
Check Helm Release Status
helm status apache -n dev-apache
Inspect Pod Logs
kubectl logs <apache-pod-name> -n apache-namespace
Would you like to dive deeper into Helm charts or expand this guide further?