CICD Pre-requisites
In this section we will setup pre-requisites for CICD lab
stateDiagram-v2
direction LR
state PrepEnvironment {
[*] --> PrepJumphost
PrepJumphost --> InstallCLIs
InstallCLIs --> [*]
}
state ConfigureInfra {
[*] --> SetEnvVars
SetEnvVars --> CreateSecrets
CreateSecrets --> [*]
}
[*] --> PrepEnvironment
PrepEnvironment --> ConfigureInfra
ConfigureInfra --> SetupTekton
SetupTekton --> [*]
Pre-requisites
Lab Pre-requisites
Deploy the NKP workload cluster with the following components:
- 1 x Control plane nodes
- 2 x Worker nodes
- 1 x Available Ingress IP
Below are minimum requirements for this lab to deploy CICD on the NKP workload cluster.
| Role | No. of Nodes (VM) | vCPU per Node | Memory per Node | Storage per Node |
|---|---|---|---|---|
| Control plane | 1 | 8 | 16 GB | 200 GB |
| Worker | 2 | 8 | 16 GB | 200 GB |
| Totals | 3 | 24 | 48 GB | 400 GB |
Install Tools on Jumphost VM
Install Tekton Client
- Login to Tekton Releases Download Page
- Select Tekton for Linux
x86_64and copy the download link to the.tar.gzfile -
If you haven't already done so, Open new
VSCodewindow on your jumphost VM -
In
VSCodeExplorer pane, click on existing$HOMEfolder -
Click on New Folder name it:
cicd -
On
VSCodeExplorer plane, click the$HOME/cicdfolder -
On
VSCodemenu, selectTerminal>New Terminal -
Browse to
cicddirectory -
Download and extract the Tekton binary from the link you copied earlier for Linux
x86_64 -
Move the binary to a directory that is included in your
PATHenvironment variable and enablekubectltekton plugin -
Verify the
tknbinary is installed correctlyNote
At the time of writing this lab tkn version is
0.44.1
Install Flux Client
-
Browse to
cicddirectory -
Download and install the
fluxbinary$ curl -s https://fluxcd.io/install.sh | sudo bash # [INFO] Downloading metadata https://api.github.com/repos/fluxcd/flux2/releases/latest [INFO] Using 2.8.5 as release [INFO] Downloading hash https://github.com/fluxcd/flux2/releases/download/v2.8.5/flux_2.8.5_checksums.txt [INFO] Downloading binary https://github.com/fluxcd/flux2/releases/download/v2.8.5/flux_2.8.5_linux_amd64.tar.gz [INFO] Verifying binary download [INFO] Installing flux to /usr/local/bin/flux -
Verify the
fluxbinary is installed correctly. Ensure the version is latestNote
At the time of writing this lab tkn version is
0.44.1
Configure Secrets, SA and RBAC
-
In the
cicdfolder, click on New File and create new file with the following name: -
Open
$HOME/cicd/.envfile in VSC and add (append) the following environment variables to your.envfile and save itexport REGISTRY_URL=_your_registry_url export REGISTRY_USERNAME=_your_registry_username export REGISTRY_PASSWORD=_your_registry_password export REGISTRY_CACERT=_path_to_ca_cert_of_registry # (1)! # Optional if using Docker - Public Docker Registry Details export DOCKER_REGISTRY_URL=_your_registry_url export DOCKER_REGISTRY_USERNAME=_your_registry_username export DOCKER_REGISTRY_PASSWORD=_your_registry_password- File must contain CA server and Harbor server's public certificate in one file
export REGISTRY_URL=https://harbor.10.x.x.111.nip.io/nkp export REGISTRY_USERNAME=admin export REGISTRY_PASSWORD=xxxxxxxx export REGISTRY_CACERT=$HOME/harbor/certs/full_chain.pem # (1)! # Optional if using Docker - Public Docker Registry Details export DOCKER_REGISTRY_URL=https://index.docker.io/v1/ export DOCKER_REGISTRY_USERNAME=dockeruser export DOCKER_REGISTRY_PASSWORD=_XXXXXXXXXX- File must contain CA server and Harbor server's public certificate in one file
-
Source the new variables and values to the environment
-
Configure Tekton with either Docker or Harbor registry
-
Create the Tekton service account (sa)
All pre-requisites are now setup. Go to next section for Continuous Integration (CI) setup.