This Helm chart facilitates the deployment of a simple backend and frontend application in a Kubernetes cluster. It automates the configuration of necessary resources, ensuring a smooth and reliable setup process.
.env file.deploy.sh script for hassle-free deployments.git clone https://github.com/2730538920101/TestHelmAPI.git
cd chart
.env FileIn the root directory of the chart, create a .env file with the following content:
API_SERVER=http://backend-service.helm-test.svc.cluster.local:5000/api
NODE_ENV=production
Ensure the deploy.sh script is in the root directory of the chart. This script automates the deployment process.
set -a
source .env
# Simulación del despliegue con dry-run
helm install helm-test . \
--set secrets.apiServer="$API_SERVER" \
--set configMap.nodeEnv="$NODE_ENV" \
--dry-run
# Preguntar si se desea proceder con el despliegue real
read -p "¿Deseas ejecutar el despliegue real? (S/N): " respuesta
if [[ "$respuesta" =~ ^[Ss|Yy]$ ]]; then
echo "Ejecutando despliegue real en el cluster..."
helm install helm-test . \
--set secrets.apiServer="$API_SERVER" \
--set configMap.nodeEnv="$NODE_ENV"
echo "¡Despliegue completado exitosamente!"
elif [[ "$respuesta" =~ ^[Nn]$ ]]; then
echo "Has cancelado el despliegue. No se aplicaron cambios."
else
echo "Respuesta no válida. Cancelando el despliegue."
fi
Run the following commands to deploy the chart:
chmod +x deploy.sh
./deploy.sh
values.yaml or passed via --namespace during deployment.API_SERVER and NODE_ENV are set dynamically from the .env file.The backend service will be available at the following internal URL within the cluster:
http://backend-service.helm-test.svc.cluster.local:5000/api
kubectl get svc frontend-service -n <namespace>
http://<EXTERNAL-IP>
Replace <EXTERNAL-IP> with the value obtained from the command above.
.env file is correctly configured.deploy.sh script is in the root directory and executable../deploy.sh --dry-run
kubectl logs -n <namespace> <pod-name>
Enjoy deploying your simple backend and frontend app with Helm!