Spring Cloud Task Application running as CronJob in Kubernetes
A Spring Cloud Task Application which runs as CronJob in Kubernetes every minute to fetch BitCoin rates, saves the rates in Mysql and notifies Users if/when the threshold is reached.
MySql Server is up and running and application is configured the MySql credentials
$ git clone https://github.com/RawSanj/spring-cloud-task-as-k8s-cronjob.git
Build and run the spring-cloud-task-as-k8s-cronjob application:
$ cd spring-cloud-task-as-k8s-cronjob
$ mvn clean package
$ mvn spring-boot:run
$ kubectl apply -f src/main/k8s
Or try Play with Kubernetes to quickly setup a K8S cluster:
-
Follow the instructions to create Kubernetes cluster.
-
Install git by running:
$ yum install git -y
-
Clone the repository:
$ git clone https://github.com/RawSanj/spring-cloud-task-as-k8s-cronjob.git
-
Update Kubernetes Secrets under
src/main/k8s/cronjob.yaml
file. -
Run spring-cloud-task-as-k8s-cronjob as Kubernetes CronJob. CronJob Pods connects to MySql server and stores Bitcoin rates every minute.
$ cd spring-cloud-task-as-k8s-cronjob
$ kubectl apply -f src/main/k8s
-
Clone and deploy the UI Application - spring-cronjob-currency by running
kubectl apply -f src/main/k8s
Apache License 2.0
Copyright (c) 2018 Sanjay Rawat