Skip to content

csye7125-su24-team17/helm-webapp-cve-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webapp CVE Consumer Helm Chart

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.

Database

Postgres database is bootstrapped when the cluster is built using terraform with bitnami postgres helm chart which can be found here

NetworkPolicy

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.

HorizontalPodAutoscaler

Created a HorizontalPodAutoscaler that automatically scales the cve-consumer-deployment between 1 and 10 replicas based on CPU utilization.

Init Container

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.

Main Container

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.

Using Helm Chart

  • 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

Monitoring Pods Using kubectl Commands

  • 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