This helm chart is used to run a Kubernetes Deployment that consumes messages from Kafka topic and pushes them to Postgres database. This Deployment creates a pod that uses a docker image built from here.
Postgres database is bootstrapped when the cluster is built using terraform with bitnami postgres helm chart which can be found here
Created a NetworkPolicy named db-network-policy that allows only pods labeled app: cve-consumer to connect to the Postgres stateful set pods on port 5432 within the specified namespace. It ensures controlled ingress traffic to the PostgreSQL database.
Created a HorizontalPodAutoscaler that automatically scales the cve-consumer-deployment between 1 and 10 replicas based on CPU utilization.
The db-migration-container runs database migrations using Flyway before the main application starts, ensuring the database schema is up-to-date. It mounts SQL scripts from ConfigMaps and uses environment variables for database connection details.
The cve-consumer-container runs the main application, configured with resource requests and limits, and retrieves database and Kafka connection details from secrets which are set up using external-secrets operator. This container runs a Kafka consumer that consumes messages from Kafka topic and pushes them to Postgres database.
- To install a chart onto a k8s cluster:
# helm install [release-name] [directory-path]
helm install my-consumer ../helm-webapp-cve-consumer
- To uninstall a chart, use:
# helm uninstall [release-name]
helm uninstall my-consumer
- To get pods, use:
# kubectl get pods -n [namespace]
kubectl get pods -n cve-consumer-namespace
- To get logs of a db migration container, use:
# kubectl logs -n [namespace] [pod-name] -c [container-name]
kubectl logs -n cve-consumer-namespace cve-consumer-deployment-* -c db-migration-container
- To get logs of a cve consumer container, use:
# kubectl logs -n [namespace] [pod-name] -c [container-name]
kubectl logs -n cve-consumer-namespace cve-consumer-deployment-* -c cve-consumer-container