k8s_deployment_service.yaml) defining both a Deployment and a Service.
Table of Contents
- Jenkins Pipeline (Jenkinsfile)
- Kubernetes Deployment & Service Manifest
- Deploying the Node.js Service
- Numeric Spring Boot Application
- Verifying the Deployment
- Links & References
Jenkins Pipeline (Jenkinsfile)
This pipeline leverages Maven for build and test, Docker for image creation and pushing, and the Kubernetes CLI (
kubectl) for deployment.Kubernetes Deployment & Service Manifest
Thek8s_deployment_service.yaml file defines:
- A Deployment named
devsecopswith 2 replicas. - A Service of type
NodePortexposing port 8080.
Ensure you replace the placeholder
replace with your Docker image tag (siddharth67/numeric-app:${GIT_COMMIT}) before applying the manifest.Deploying the Node.js Service
We need a backend service that our Spring Boot app will call. Deploy a pre-built Node.js service (siddharth67/node-service:v1) in the default namespace:
http://node-service:5000.
Numeric Spring Boot Application
Update your controller to call the Kubernetes service instead oflocalhost. Example:
main branch—Jenkins will automatically trigger the pipeline.
Verifying the Deployment
After the pipeline completes, verify both applications:http://<NODE_IP>:31933/→Kubernetes DevSecOpshttp://<NODE_IP>:31933/increment/77→78http://<NODE_IP>:31933/compare/44→Less than 50http://<NODE_IP>:31933/compare/95→Greater than 50