Skip to content

Latest commit

 

History

History
89 lines (65 loc) · 3.54 KB

File metadata and controls

89 lines (65 loc) · 3.54 KB

My Helm Project

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.

Project Structure

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 specific
  • conf-: 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

Installation

To install the Helm chart, follow these steps:

  1. Ensure you have Helm installed on your machine.
  2. Navigate to the project directory:
    cd drift-detection
    
  3. Install the chart:
    helm install la-rebelion-drift-detection .
    

Configuration

You can customize the deployment by modifying the values.yaml file. This file contains default values for the templates in the chart.

Services

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.

Cluster Requirements

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 

Usage

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.

License

This project is licensed under the MIT License.