Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Installing and Deploying Jenkins Master

Updated on 2024-12-28 GMT+08:00
NOTE:

On the Jenkins page, the UI strings in Chinese and English are different. The screenshots in this section are for your reference only.

Selecting an Image

Select a relatively new, stable image from Docker Hub. For this test, select jenkinsci/blueocean, which is bound with all Blue Ocean add-ons and functions. There is no need to install Blue Ocean add-ons separately. For details, see Installing Jenkins.

Preparations

  • Before creating a containerized workload, buy a cluster (the cluster must contain at least one node with four vCPUs and 8 GiB memory). For details, see Buying a CCE Cluster.

    The Docker in Docker scenario is required, which is, running the Docker commands in the container. Select the Docker container engine for the node.

  • To enable external networks to access the workload, ensure that an elastic IP address (EIP) has been bound to or a load balancer has been configured for at least one node in the cluster.

Installing and Deploying Jenkins on CCE

  1. Log in to the CCE console, choose Workloads > Deployments and click Create Workload on the upper right corner.
  2. Configure basic workload parameters.

    • Workload Name: jenkins (customizable)
    • Namespace: Select the namespace where Jenkins will be deployed. You can create a namespace.
    • Pods: Set it to 1.

  3. Configure basic container parameters.

    • Image Name: Enter jenkinsci/blueocean. Select an image version as required. If no version is selected, the latest version will be used by default.
    • CPU Quota: Set Limit to 2 cores.
    • Memory Quota: Set Limit to 2048 MiB.
    • Privileged Container: If Jenkins with a single Master is used, the privileged container must be enabled so that the container can perform operations on the node. Otherwise, you cannot run the Docker commands in the Jenkins Master container.
    Retain the default values for other parameters.
    Figure 1 Basic container parameters

  4. Click Data Storage and add a persistent storage volume.

    Click Add Volume, select PVC from the drop-down list, and add a storage volume. Enter /var/jenkins_home under Mount Path to mount the storage volume to /var/jenkins_home of the Jenkins container for persistent data storage.
    NOTE:

    The cloud storage type can be EVS or SFS. If no cloud storage is available, click Create PVC.

    If you select EVS, the AZ of the EVS disk must be the same as that of the node.

    Figure 2 Adding a cloud volume

  5. Add permissions to the Jenkins container so that related commands can be executed in it.

    1. Ensure that Privileged Container is enabled in 3.
    2. Click Data Storage, click Add Volume, select hostPath, and mount the host path to the corresponding container path.
      Table 1 Mounting path

      Storage Type

      Host Path

      Mounting Path

      hostPath

      /var/run/docker.sock

      /var/run/docker.sock

      hostPath

      /usr/bin/docker

      /usr/bin/docker

      hostPath

      /usr/lib64/libltdl.so.7

      /usr/lib/x86_64-linux-gnu/libltdl.so.7

      hostPath

      /usr/bin/kubectl

      /usr/local/bin/kubectl

      After the mounting is complete, the page shown in Figure 3 is displayed.
      Figure 3 Mounting the host paths to the corresponding container paths

    3. In Security Context, set User ID to 0 (user root).
      Figure 4 Configuring the user

  6. Specify the access mode in Service Configuration.

    The Jenkins container image has two ports: 8080 and 50000. Configure them separately. Port 8080 is used for web login, and port 50000 is used for the connection between Master and Agent.

    In this example, two Services are created:

    • LoadBalancer: provides external web access using port 8080. You can also select NodePort to provide external access.

      Set the Service name to jenkins (customizable), the container port to 8080, the access port to 8080, and retain the default values for other parameters.

    • ClusterIP: used by the Agent to connect to the Master. The IP addresses of jenkins-web and jenkins-agent need to be the same. Therefore, port 8080 for web access and port 50000 for agent access are included.

      Set the Service name to agent (customizable), the container port 1 to 8080, the access port 1 to 8080, the container port 2 to 50000, the access port 2 to 50000, and retain the default values for other parameters.

      NOTE:

      In this example, Agents and the Master are deployed in the same cluster. Therefore, the Agents can use the ClusterIP Service to connect to the Master.

      If Agents need to connect to the Master across clusters or through the public network, select a proper Service type. Note that the IP addresses of Jenkins-web and Jenkins-agent need to be the same. Therefore, ports 8080 and 50000 must be enabled for the IP address connected to jenkins-agent. For addresses used only for web access, enable only the port 8080.

    Figure 5 Adding a Service

  7. Retain the default settings for Advanced Settings and click Create Workload.
  8. Click Back to Deployment List to view the Deployment status. If the workload is in the Running status, the Jenkins application is accessible.

Logging In and Initializing Jenkins

  1. On the CCE console, click the name of the target cluster to access the cluster console. Choose Services & Ingresses in the navigation pane. On the Services tab, view the Jenkins access mode.

    Figure 6 Access mode corresponding to port 8080

  2. Enter EIP:8080 of the load balancer in the browser address box to visit the Jenkins configuration page.

    When you visit the page for the first time, you are prompted to obtain the initial administrator password. You can obtain the password from the Jenkins pod. Before running the following commands, connect to the cluster using kubectl. For details, see Connecting to a Cluster Using kubectl.

    # kubectl get pod -n cicd
    NAME                                     READY   STATUS    RESTARTS   AGE
    jenkins-7c69b6947c-5gvlm                 1/1     Running   0          17m
    # kubectl exec -it jenkins-7c69b6947c-5gvlm -n cicd -- /bin/sh
    # cat /var/jenkins_home/secrets/initialAdminPassword
    b10eabe29a9f427c9b54c01a9c3383ae

  3. The system prompts you to select the default recommended add-on and create an administrator upon the first login. After the initial configuration is complete, the Jenkins page is displayed.

Modifying the Number of Concurrent Build Jobs

  1. On the Jenkins dashboard page, click Manage Jenkins on the left, choose System Configuration > Manage nodes and clouds, and select Configure from the drop-down list of the target node.

    NOTE:
    • You can modify the number of concurrent build jobs on both Master and Agent. The following uses Master as an example.
    • If the Master is used with Agents, you are advised to set the number of concurrent build jobs of Master to 0. That is, all build jobs are performed using Agents. If a single Master is used, you do not need to change the value to 0.

  2. Modify the maximum number of concurrent build jobs. In this example, the value is changed to 2. You can change the value as required.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback