On the project, we will setup helmchart value project, it contains deployment, service of kubernetes object.
Donwload my project helmvalues at https://github.com/daotq2000/aws-zero-downtime-jenkins
The purpose of project are packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources Setup environment secret, scale config, network type and limit CPU used like image below: Config Domain, Health check like image below:
Now, we need to ssh to Bastion host, where installed jenkins server and generate ssh key allow each time run build, jenkins server can pull latest change commit from github.
Follow these steps to add ssh key to github:
Copy private key
Fill ID with jenkins-git Next, paste your private have been copy to this
Go to github, click to right side bar and click setting Get public key using command:
$cat ~/.ssh/id_rsa.pub
Go to SSH and GPG keys, and paste your public key to this. After successfully, we receive result below
Create new project pipeline and config the pipeline. Use pipeline below:
def gitUrl = 'git@github.com:daotq2000/aws-spring-sqs-queue.git'
def gitBranch = 'main'
def gitCredential = 'jenkins-git'
pipeline {
stages {
stage('Checkout project') {
steps {
git branch: gitBranch,
credentialsId: gitCredential,
url: gitUrl
}
}
}
}
If you got result below, you have built success.
Issue related build failed, may be have some reason below
Verify host failed
, please following solution below:Solution: Go to Jenkins -> DashBoard -> Manage Jenkins -> Security -> Git Hot Key Verification and Configuration and choose No Verification 3. Git doesn’t install yet on bastion host. Solution: Check git version on bastion host using
git -v
if you doesn’t install, let install git
sudo yum install git -y
After we will pull repository by git clone
command
git clone {your_git_repository}
If you get result like image below, you are successfully pull repository to server.