Jenkins on IBM Cloud

This tutorial demonstrates how to deploy Jenkins on IBM Cloud. Before deploying, you should have an IBM Cloud account, otherwise you can register here. At the end of the tutorial you will have a cluster with Jenkins up and running.

To deploy Jenkins on IBM Cloud:

  1. Provision a Kubernetes Cluster. If you already have a Kubernetes cluster, you can skip to step 2.

  2. Deploy IBM Cloud Block Storage plug-in. If you have already deployed the the IBM Cloud Block Storage plug-in, you can skip to step 3.

  3. Deploy Jenkins.

  4. Verify the Jenkins installation.

Provisioning a Kubernetes cluster

When deploying Jenkins to IBM Cloud, you must first provision a Kubernetes cluster.

If you already have a Kubernetes cluster, you can skip to Deploying the IBM Cloud Block Storage plug-in.

To provision a Kubernetes cluster:

  1. Select Catalog in the upper left corner.

  2. Select Service from the catalog.

  3. Search for Kubernetes Service and select it.

    IBM Kubernetes selection

    You are now at the Kubernetes deployment page, and you need to specify some details about the cluster.

  4. Choose a plan type of standard or free. The free plan only has one worker node and no subnet.

  5. To provision a standard cluster, you will need to upgrade your account to Pay-As-You-Go. To upgrade to a Pay-As-You-Go account, complete the following steps:

    1. In the console, go to Manage > Account

    2. Select Account settings, and then select Add credit card.

    3. Enter your payment information, select Next, and then submit your information.

  6. To choose Classic or VPC, read the docs, and then select the most suitable type for yourself.

    IBM infrastructure selection
  7. Now choose your location settings. For more information, please refer to Locations.

    1. Choose Geography (continent).

      IBM geo location
    2. Choose Single or Multizone. In single zone, your data is kept in only one datacenter. With Multizone, it is distributed to multiple datacenters, and thus safer in an unforeseen zone failure.

      IBM available locations
    3. Choose a Worker Zone if you use Single zones or Metro if you use Multizone.

      IBM worker location
    4. If you wish to use Multizone, set up your account with VRF or enable VLAN spanning.

      If at your current location selection, there is no available Virtual LAN, a new VLAN is created for you.
  8. Choose a Worker node setup or use the preselected one, and then set Worker node amount per zone.

    IBM worker-pool
  9. Choose a Master service endpoint.

    When you have a VRF-enabled account, your cluster is set up to use both private and public endpoints by default.
    1. Select Private endpoint only to make your controller accessible on the private network or via VPN tunnel.

    2. Select Public endpoint only to make your controller publicly accessible. For more information, refer to endpoints.

    IBM endpoints
  10. Enter a Cluster name.

    IBM new cluster name
  11. Apply the desired Tags to your cluster. For more information, refer to tags.

    IBM adding tags to cluster
  12. Select Create.

    IBM new cluster creation
  13. Wait for your cluster to be provisioned.

    IBM cluster provisioning

Your cluster is now ready to use.

IBM cluster is ready

Deploying the IBM Cloud Block Storage plug-in

Once you have provisioned a Kubernetes cluster, you must deploy the IBM Cloud Block Storage plug-in. The Block Storage plug-in is a persistent, high-performance iSCSI storage that you can add to your apps by using Kubernetes Persistent Volumes (PVs).

To deploy the Block Storage plug-in:

  1. Select Catalog in the upper left corner.

  2. Select Software from the catalog.

  3. Search for IBM Cloud Block Storage plug-in and select it.

    IBM block search
  4. On the application page, select the empty dot next to the cluster you wish to use.

  5. Select Target namespace and choose the default namespace or enter a custom namespace.

    If you receive an error, please wait 30 minutes for the cluster to finalize.
    IBM namespace selection
  6. Assign a name to this workspace.

  7. Select Install and wait for deployment.

    IBM block storage create

Deploying Jenkins

Once you have provisioned a Kubernetes cluster and deployed the IBM Cloud Block Storage plug-in, you can deploy Jenkins on your cluster.

To deploy Jenkins on your cluster:

  1. Select Catalog in the upper left corner.

  2. Select Software from the catalog.

  3. Search for Jenkins and select it.

    IBM workspace search
  4. Select IBM Kubernetes Service.

    IBM Kubernetes selection
  5. On the application page, select the empty dot next to the cluster you wish to use.

    IBM cluster selection
  6. Select Target namespace and then choose the default namespace or use a custom one.

    IBM space name
  7. Give a unique Name to the workspace, that you can easily recognize.

    IBM workspace name
  8. Select the Resource group you want to use. This is for access control and billing purposes. For more information, please refer to resource groups.

    Resource details
  9. Assign tags to your Jenkins instance. For more information, refer to tags.

    Default value parameters
  10. Select Parameters with default values. You can set custom deployment values or use the default ones.

    IBM parameters setup
  11. Set the Jenkins password in the parameters.

    Create password instructions
  12. Once complete, acknowledge the license agreement and select Install.

    Installation instructions

    The Jenkins workspace begins installing. Wait for the installation to complete.

    Workspace installation screen

    Once complete, your Jenkins workspace is now successfully deployed.

    IBM workspace deployment screen

Verifying the Jenkins installation

After deploying Jenkins on your cluster, you can verify the Jenkins installation.

To verify the Jenkins installation:

  1. Go to Resources in your browser.

  2. Select Clusters.

  3. Select your cluster.

    Resource selection screen

    Now you are at your cluster overview.

  4. Select Actions in the top right corner of the page.

  5. Select Web terminal in the dropdown menu.

    Clusters overview page
  6. Select Install and then wait for the installation to complete.

    terminal install screen
  7. Once installation has completed, you must repeat this process.

    1. Select Actions.

    2. Select Web terminal and a terminal window opens.

  8. Type in the terminal. You must change NAMESPACE to the namespace you chose during the deployment setup.

    $ kubectl get ns
    get-ns command
    $ kubectl get pod -n NAMESPACE -o wide
    get-pods command
    $ kubectl get service -n NAMESPACE
    get-service command

    The running Jenkins service is now visible.

  9. Copy the External-IP, you can access the website on this IP.

  10. Paste it into your browser.

    The Jenkins login portal should now be visible.

    Jenkins login page
  11. Please enter your username (the default is user) and your password, which you set at the deployment phase.

    Jenkins dashboard

You have successfully deployed Jenkins on IBM Cloud!