The purpose of this repository is to create a fully functional virtual enviroment:
- running on Kubernetes Cluster,
- with private docker registry,
- Jenkins with self-update job triggered by change in git repository,
- ingress with MetalLB(solution for local use of K8s),
- bash script to automate the start-up process.
We use Vagrant to manage VirtualBox virtual machines and Ansible to provision them.
x | Recommended | Minimum |
---|---|---|
Available RAM | 16 GB | 8 GB |
CPUs | 8 cores | 4 cores |
- Vagrant
- VirtualBox
- Github repository where you will be uploading jobs
Here you can find some resources that should help you understand how tools, that I used, work.
Here you can edit the HW requirements. Inside the Vagrantfile you can see couple of variables:
*_NODES
= number of nodes to create,
*_RAM
= amount of RAM in MB for each of the node,
*_CPUS
= number of CPU cores to attach to each node.
# Image configuration - DO NOT CHANGE
# https://app.vagrantup.com/boledovicpantheon/boxes/testing-academy-22.04_LTS
IMAGE_NAME = "boledovicpantheon/testing-academy-22.04_LTS"
IMAGE_VERSION = "0.1.0"
# Worker config
WORKER_COUNT = 2 # Do not change unless you need to
WORKER_RAM = 2048
WORKER_CPUS = 2
# Master config
MASTER_COUNT = 1 # DO NOT CHANGE
MASTER_RAM = 8192
MASTER_CPUS = 4
The worker node serves as a slave - it will be executing almost all tasks.
The master node serves as a control node, thats why it needs more RAM and CPUs.
If you changed the number of worker nodes, you also need to add an entry in ${project_dir}/ansible/inventory/hosts.yaml
.
You can change them, but is not recommended.
These are automatically generated by Vagrant:
DNS | IP address |
---|---|
node-1 | 192.168.56.101 |
node-2 | 192.168.56.102 |
master-1 | 192.168.56.11 |
These ones are automatically configured in K8s cluster, if you want to access them on local machine, follow steps in section "Running the enviroment".
DNS | IP address | Port |
---|---|---|
example.jenkins.com | 192.168.56.240 | 80 |
docker.registry.com | 192.168.56.11 | 5000 |
As this project is for testing purposes only, we use the same username and password everywhere.
Username: user
Password : password
Provisioning should not be longer than 30 minutes, but it depends on your hardware capacity and internet connection.
- Create public Github(or alternative) repository and replace the url in
$(project_dir)/jenkins/jobs/update-job.yaml
. Make sure branches are correct too. When you change or upload file to this repository, Jenkins will detect change, build and push jobs to Jenkins controller.
scm:
- git:
url: "https://github.com/boledovicpantheon/jenkins-job-definitions.git"
branches:
- origin/main
basedir: jobs
-
Clone repository to your local machine:
git clone https://github.com/boledovicpantheon/testing-academy.git
-
From inside the repository on your terminal, run
vagrant up
-
Add DNS entry to your local machine with IP
192.168.56.240
and DNS nameexample.jenkins.com
. This way you will be able to access Jenkins controller on your local machine. It runs on port 80, so no need to specify it.
Private docker registry is accesible only inside cluster, if you want to access it from your local machine also, you need to add IP
192.168.56.11
and DNS name docker.registry.com
to your DNS records.
Don't forget that docker registry runs on port 5000!