Goal: To have hands-on experience in creating from scratch enterprise level CI/CD pipelines, from code commit to building packages, to security scans to infra provisioning to mail notification of completion, while enabling monitoring.
Workflow:
- Tried to run SonarQube and Nexus locally via docker, but did not have enough resources.
- Used Terraform to provision 5 EC2 instances with required cpu, storage and inbound rules - 3 for Kubernetes, 1 for SonarQube and 1 for Nexus artifact repository.
- Used kubeadm for K8s setup, 1 Master & 2 Slave Nodes
- Ran Jenkins from local docker. ( this came back to bite me)
- Installed relevant Jenkins Plugins, Configured the tools that will be used in pipeline, Stored the relevant secrets/credentials for Sonar / Nexus / Docker / Kubernetes in Jenkins Credentials.
- Used my springboot REST project as the source code.
- Was able to successfully build, test, run a Trivy filesystem test, run Sonar scan on the code, package the code and upload the code to nexus.
- Faced issue while pushing the Dockerfile to DockerHub.
- Faced issue with deploying into K8s cluster.
Current Issues:
- The Docker plugin for Jenkins didn’t seem to work, it couldn’t run docker commands.
- Could deploy the service.yml from Jenkins into the K8s Cluster.
Solutions:
For 1. Tried restarting the jenkins instance, still the option to configure Docker didnt show in Manage Jenkins > System. Solution might be to run in an EC2 instance, with the latest Jenkins docker image.
For 2. As the Jenkins instance was run locally, I didnt open the port 6443, usually used by K8s api-server. Running Jenkins on EC2 with the right ports open will fix this as well.
Future Plans:
Will try this again tomorrow, but just the Jenkins-Docker-K8s section of the pipeline.
Github
Top comments (0)