Jenkins implements continuous integration and continuous deployment (CI/CD) processes. Deploy Jenkins in an ACK cluster to ensure high availability (HA) of services and reduce O&M costs. This topic describes how to deploy Jenkins in an ACK cluster and demonstrates its building and deployment procedure using a simple application example.
Prerequisites
Helm CLI is installed and connected to the cluster using kubectl. For detailed instructions, see Installing Helm and Connect to an ACK cluster using kubectl.
Notes
Developers are responsible for maintaining the Jenkins system. This section does not provide enterprise-level technical support.
The Helm Chart and images used by Jenkins are from overseas sources, which may cause pull failures. Refer to the following solutions:
Subscribe to overseas source images using Container Registry. For instructions, see Sync images from sources outside China using artifact subscription.
Create a Global Accelerator (GA) instance to pull images directly using its global acceleration network. For details, see Using GA to accelerate cross-region container image pulling in ACK.
Step 1: Deploy Jenkins
Configure the Jenkins Helm repository.
helm repo add jenkins https://charts.jenkins.io helm repo updateExpected output:
Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "jenkins" chart repository Update Complete. ⎈Happy Helming!⎈Install Jenkins.
Create the
cicdnamespace.kubectl create ns cicdDeploy Jenkins to the
cicdnamespace.helm -n cicd install jenkins jenkins/jenkins \ --set persistence.storageClass="alicloud-disk-essd" \ --set persistence.size="20Gi" \ --set controller.serviceType="LoadBalancer" \ --set controller.admin.password="****"persistence.storageClass: Required. Creates a cloud disk persistent volume for persistent storage of the jenkins_home directory files. When set to"alicloud-disk-available", the system automatically selects an available cloud disk type.persistence.size: Required. The cloud disk size. The minimum specification for Alibaba Cloud ECS cloud disks is 20 GiB.controller.serviceType: Optional. The Service type. Default is ClusterIP.controller.admin.password: Optional. Specifies the admin password. A random password is generated by default.
For more deployment parameters, see helm-charts.
Check and wait for the Jenkins pod to run normally.
kubectl -n cicd get poExpected output:
NAME READY STATUS RESTARTS AGE jenkins-0 2/2 Running 0 3m3s
View the Service external IP address.
If you deploy a LoadBalancer Service, access the Jenkins service through a browser.
kubectl get -n cicd serviceExpected output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE jenkins LoadBalancer 192.168.***.*** 8.222.***.*** 8080:30949/TCP 2d17h jenkins-agent ClusterIP 192.168.***.* <none> 50000/TCP 2d17h
(Optional) Create a Pipeline Task
For example, create a first-pipeline pipeline task. When building a pipeline, Jenkins dynamically starts a Slave pod from the current ACK cluster by default and executes the build task. After the build task completes, it immediately releases the Slave pod. For more Jenkins configuration information, see Jenkins.
Log on to Jenkins. In the navigation pane on the left, click New Item.
In the Enter an item name area, enter the name first-pipeline, select the Pipeline type, and then click OK.
At the top of the page, click the Pipeline tab, select the Hello World template, and then click Save.

In the navigation pane on the left, click Build Now to execute the build.
In the navigation pane on the left, click Build History, then click 1# to enter the pipeline details page, and then click Console Output to view the pipeline build results.
FAQ
How to Obtain the Default Random Jenkins Password?
If you do not specify a logon password when deploying Jenkins, execute the following command to obtain the default random Jenkins password.
kubectl -n cicd exec -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo