Simple demo application as an example of an external state store deployed capability. Built using the Go language with GoLand and the htmx Javascript library to generate interactive DOM segments. The application requires an available Redis key value store configured through environment variables.
Demonstrated with a local K8s cluster using Orbstack and k9s for visualization
- Kubernetes Pod and Deployment
- NodePort routing
- Ingress routing
- Configuration through environment variables
- Deployment Health checks
Go from local development through to a deployed application
- Start the local container for Redis via docker-compose
docker compose --file scripts/docker-compose.yaml up -d
- Launch the Application from the IDE with configuration
- Verify 'Hello' endpoint using localtest.http (used for health check)
- Show the application running on http://localhost:8080
note Redis is already deployed as a running service
- Docker build of the container
docker build -t stayorgo:0.1 .
- Show pod definition yaml
- Deploy as a pod scripts/k8s/pod-deployment/stayorgo-pod.yaml
kubectl apply -f scripts/k8s/pod-deployment/stayorgo-pod.yaml
- Local port-forward to port 8080
kubectl port-forward stayorgo-pod 8080:8080
- Show the application executing (connected to Redis in K8s)
- Show shutdown without restart
- Show Deployment, Service and NodePort
- Apply scripts/k8s/service-nodeport/stayorgo-service-nodeport.yaml
- Show the application running on http://localhost:30007
- Show Deployment, Service, and Ingress
- Apply scripts/k8s/service-ingress/stayorgo-service-ingress.yaml
- Show the application running on http://stayorgo.k8s.orb.local
- Show scaling the application
- Show deleting a replica
- Show restarting a deployment
Tested with version 3.4
Install the Ingress controller and CRDs directly using the default values and the yaml. Instructions
Get the CRDs to install ahead of the Helm chart installation Install CRD
cd kubernetes-ingress/deployments/common
kubectl apply -f ingress-class.yaml
cd kubernetes-ingress/deploy
kubectl apply -f crds.yaml
# results in
customresourcedefinition.apiextensions.k8s.io/dnsendpoints.externaldns.nginx.org created
customresourcedefinition.apiextensions.k8s.io/globalconfigurations.k8s.nginx.org created
customresourcedefinition.apiextensions.k8s.io/policies.k8s.nginx.org created
customresourcedefinition.apiextensions.k8s.io/transportservers.k8s.nginx.org created
customresourcedefinition.apiextensions.k8s.io/virtualserverroutes.k8s.nginx.org created
customresourcedefinition.apiextensions.k8s.io/virtualservers.k8s.nginx.org created
The version is the Chart version and not the application version
helm pull oci://ghcr.io/nginxinc/charts/nginx-ingress --untar --version 1.1.2
cd nginx-ingress
helm install nginx-ingress-3-4 .
I chose the name nginx-ingress-3-4 for the helm install also . chooses the default values.yaml (look it over first for your desired configuration)
The default configuration listens on port 80 and 443 for routing
Why readiness and healthiness tests are important Hello IT, have you tried turning it off and on again?
Spending more on Kubernetes due to overprovisioning compute resources InfoQ Article