Skip to content

lufisaal/simpleNginxApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple web app

Content

Simple web application deployed on a local Kubernetes cluster using Kind. Helm is used to package and deploy the application using a Helm chart. Nginx serves the static HTML page, which includes dynamic content based on the Kubernetes namespace. Terraform is used to manage the infrastructure and deploy the Kubernetes resources and Helm release.
This application could be deployed with terraform to a local cluster created with kind. 

Description

The application is a basic web application powered by Nginx. It serves a static HTML page that displays information about the Kubernetes namespace in which it is deployed. The HTML page is dynamically generated using template variables.

For this we have some requirements as 
- terraform
- helm
- kind [requires docker as daemon set]
- kubectl
- [optional] k9s

Note: This is a simplified overview, and additional tools and configurations may be required depending on your specific setup

How to use


With terraform

Move inside this repository and simply run these commands:

  1. Deploy terraform code:
terraform init
terraform apply -auto-approve
  1. Redirection port for our localhost:
kubectl --namespace default port-forward service/webapp-ngix-service 8888:80

This line will showup when deploy with helm.

  1. See the result in http:localhost//localhost:8888/
  2. Further configurations can be done here where the variables are set with default values.

With helm

Move inside this folder and simply run these commands:

  1. install helm charts:
helm install <name> <path> 
  1. Redirection port for our localhost:
kubectl --namespace default port-forward service/webapp-ngix-service 8888:80
  1. See the result in http:localhost//localhost:8888/

  2. Further configurations can be done here where the variables are set with default values.


Usefull links

kind release --> https://github.com/kubernetes-sigs/kind/releases

Usefull commands

# kubectl, K as local alias for kubectl 
kubectl get deployment
k get services
k get configmap
k get nodes
k --namespace <namespace> port-forward service/<appName>-service 8888:80 
k create namespace <name>

# kind
kind create cluster --name <name>     
kind delete cluster --name <name>
kind get clusters
# to load a local docker image to our cluster
kind load docker-image <image>:<tag> --name <cluster-name>

# Helm
helm lint
helm template <path>
helm install --dry-run <name> <path>
helm install <name> <path>
helm upgrade <name> <path>
helm list
helm rollback <name>
helm rollback <name> <revision-number>
helm uninstall <name>

Notes

This is an example application. May or may not work properly.

The terraform deployment may need some extra steps to open traffic to you kubernetes cluster not described here.

About

Kubernetes with helm and terraform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages