This project is a Helm chart for deploying a sample application with two services, a stateful set, and a deployment. The application is configured to use BusyBox images and demonstrates how to manage configurations and secrets in Kubernetes.
For easy listing and understanding, the file names are prefixed with a code that represents the type of file. The code is as follows:
0-
: Application specificconf-
: Configuration files, including ConfigMaps and Secrets.netw-
: Network files, including Ingress, Services, and Endpoints.wrkl-
: Workload files, including Deployments, StatefulSets, and Jobs.
Deployment and statefulset resources are configured to use the index-html
configmap and display the content of the index.html
file, populated with all the config values; just a simple example to simulate a web application and its configurations - feel free to replace it with your own application.
drift-detection
├── Chart.yaml
├── README.md
├── templates
│ ├── 0-configmap-index-html.yaml
│ ├── NOTES.txt
│ ├── _helpers.tpl
│ ├── conf-secret-app.yaml
│ ├── conf-secret-db.yaml
│ ├── configmap-app.yaml
│ ├── configmap-db.yaml
│ ├── netw-ingress.yaml
│ ├── netw-service-app.yaml
│ ├── netw-service-db.yaml
│ ├── wrkl-deployment.yaml
│ └── wrkl-statefulset.yaml
└── values.yaml
To install the Helm chart, follow these steps:
- Ensure you have Helm installed on your machine.
- Navigate to the project directory:
cd drift-detection
- Install the chart:
helm install la-rebelion-drift-detection .
You can customize the deployment by modifying the values.yaml
file. This file contains default values for the templates in the chart.
This project includes:
- A StatefulSet with 2 replicas for managing stateful applications.
- A Deployment with 2 replicas for stateless applications.
- ConfigMaps for application and database configurations.
- Secrets for sensitive information such as database credentials.
This chart requires a Kubernetes cluster where you can access the services using the NodePort service type. You can also use a LoadBalancer service type if your cluster supports it.
If you don't have a cluster, you can create one, for your convenience I have created a guide to install a Kubernetes cluster using K0s, K3s, minikube, or microk8s. Kubernetes in Docker (Kind) is another great tool for testing Kubernetes configurations locally. Or you can use the "K1s, a Serverless Kubernetes" to access a Kubernetes cluster in 1 second withouth any installation, no resource management, no cost.
Port-forward the services to access them from your local machine:
kubectl port-forward svc/db-service 5432:5432
kubectl port-forward svc/app-service 8080:8080
This will create two services with NodePort type that you can access from your local machine. Access the services by running the following command:
curl
Once the chart is installed, you can access the services as defined in the service-app.yaml
and service-db.yaml
templates. The application pods will print the environment variables configured from the ConfigMaps and Secrets.
This project is licensed under the MIT License.