- This deployment sample project is based on a sample Java Maven project
- It's creating a Kind Cluster
- Deployment options
- Simple manual manifest deployment
- Flux continence deployment
- Using Flux Image Policy for ongoing docker image updates
- Setup required tools script
- The Jenkins pipeline is executing the below deployment script.
- Its for testing and demonstration purposes only and as such its deleting the existing cluster (if created).
- The pipeline is parameterized to support the below deployment options: Flux or manual manifest deployment.
- Note: This is only an example to demonstrate the CD principle. For real life scenarios you might want to split between the pipelines of deployment and infrastructure creation
cd ~/[your-workspace]
https://github.com/devozs/weather-app-cd.git
cd weather-app-cd
running the script ./install-cluster.sh
will create a Kind cluster.
There are two possible ways to deploy the sample Java Maven project
./install-cluster.sh -t manual
./install-cluster.sh -t flux -f your-github-account
For example ./install-cluster.sh -t flux -f devozs
Make sure to have GitHub PAT
For more information refer to the Getting Started with Flux
kubectl get pods -n flux-system
NAME READY STATUS RESTARTS AGE
helm-controller-6dcbff747f-76xlv 1/1 Running 0 8m10s
image-automation-controller-75f784cfdc-29zcg 1/1 Running 0 8m10s
image-reflector-controller-67d6bdcb59-xb9m5 1/1 Running 0 8m10s
kustomize-controller-5bb9984cf9-7l7nk 1/1 Running 0 8m10s
notification-controller-7569f7c974-clccq 1/1 Running 0 8m10s
source-controller-5b976b8dd6-w6gjn 1/1 Running 0 8m10s
flux get image policy -A
NAMESPACE NAME READY MESSAGE LATEST IMAGE
flux-system weather-app True Latest image tag for 'devozs/weather-app' resolved to: 0.0.3 devozs/weather-app:0.0.3
kubectl get pod
NAME READY STATUS RESTARTS AGE
weather-app-65ccb54c-z7cfv 1/1 Running 0 8m27s
Run the following script ./verify-deployment.sh
or manually run the below commands:
POD_NAME=$(kubectl get pods --template '{{range .items}}{{.metadata.name}}{{end}}' | grep weather-app)
kubectl logs ${POD_NAME}
2021/08/21 11:44:50.011 [INFO] [org.devozs.weather.WeatherApp] Task performed on: Sat Aug 21 11:44:50 GMT 2021, Thread's name: TIMER
2021/08/21 11:44:50.011 [INFO] [org.devozs.weather.WeatherApp] Getting Weather...
2021/08/21 11:44:51.722 [INFO] [org.devozs.weather.WeatherApp] Response Code: 200