Navigate to the web console for your ICP installation
Open a web browser to the IBM Cloud Private management console at https://icp-address:8443. Login using your admin user id and password.
Create a namespace for your deployment
- Open the menu in the IBM Cloud Private web console.
- Select the Manage group and then select the Namespaces page.
- Select the Create Namespace button
- Specify a name for the new namespace, in this example the name dev-deploys is used.
- Select the Create button
Create a certificate in the new namespace
The certificate will be used for TLS termination of the deployed application. The certificate manager shared service is used to create and manage the certificate. Details on creating certificates are available in the IBM Cloud Private Knowledge Center.
- Open a command window for the IBM Cloud Private installation by selecting the icon on the bottom right of the web console.
- Create a file named cert.yaml that contains the following contents which is provided as a sample certificate in the Knowledge Center.
# name of the tls secret to store
# the generated certificate/key pair
# ClusterIssuer Name
# Issuer can be referenced
# by changing the kind here.
# the default value is Issuer (i.e.
# a locally namespaced Issuer)
# one or more fully-qualified domain names
# can be defined here
Edit the lines in the sample certificate file as follows
- Specify a custom certificate name by updating the name field from hello-deployment-tls-1 to your customized value.
- Specify the correct namespace by updating the namespace value from foobar to the namespace created in step 2.
- Specify a custom secret name by updating the secretName field from hello-deployment-tls-1 to your customized value.
- Change the commonName field from foo1.bar1 to the host plus domain name used to access the application on this cluster.
- Change the entries under dnsNames so foo1.bar1 is no longer included but any other hosts that can be used to access the application must be added.
- Save the file and run the command:
kubectl create -f cert.yaml
to create the certificate.
- Validate the certificate was created successfully by running the command below substituting the namespace name you created previously for dev-deploys.
kubectl describe certificate -n dev-deploys
Validate the Status shows the certificate was created.
Deploy your application
This sample deploys the ibm-jenkins-dev chart, but you can extend this example to apply to other charts as well. Keep the command window open on the current browser window since it will continue to be used later. Open another browser window and access the IBM Cloud Private web console again from the new window.
Install the ibm-jenkins-dev chart
- Select the Catalog link from the banner of the IBM Cloud Private web console
- Select the ibm-jenkins-dev chart
- Select the Configure button
- Specify a Helm release name
- Select the namespace created in step 2
- Select the checkbox to agree to the license agreement
- Under Parameters, select “All parameters” to expand all parameters.
- Unselect “Enable persistence for this deployment” since this sample install will not use persistence
- Select Install
Validate the deployment completes successfully
- Select the View Helm Release link
- Wait a few minutes for the pod to change to the “Running” state
- Step 2 in the Notes at the bottom of the deployment page shows how to obtain the NodePort that can be used to access the jenkins server. Run the listed command to obtain the port value.
- Open a new browser window and navigate to the URL http://<external_ip>:<port_value> where <port_value> is the port obtained in the previous step.
Validate that you can access the jenkins server’s web console.
Create an ingress for TLS termination
Instead of accessing the jenkins server over HTTP, we want to provide a secure connection over HTTPS. This step creates the ingress definition necessary to expose the jenkins server over HTTPS. The HTTPS connection uses the certificate created in step 3.
- In the command window for IBM Cloud Private edit a new file named ingress.yaml
- Paste in the contents from the Ingress sample found in the Knowledge Center that is also included here:
- host: foo1.bar1
Make the following changes to the sample ingress
- Change the name field’s value from hello-k8s-ingress-tls to your custom value
- Add a namespace entry below the name similar to the entry below:
Make sure you use your namespace name. In this sample the namespace is dev-deploys
- Below the “ -hosts” line, change the hostname foo1.bar1 to the common name that you used in your certificate
- Change the secretName to the name of the secret defined in the certificate’s secretName field from recipe step 3.
- Below the “ rules:” line, change the host entry from foo1.bar1 to the same value used under “ -hosts“.
- Change the serviceName to match the service name created by the deployment. The service name is based off of the helm release name you chose when you deployed the jenkins server. Obtain the service name from the Service table listed on the deployment page for the helm chart.
- Change the servicePort value from 80 to 8080
- Change the path from /fb to /
- Save the changes
- Create the ingress with the command:
kubectl create -f ingress.yaml
Validate the ingress
Make sure the ingress is working properly and is exposing the jenkins server using the certificate created for the ingress.
- Open a new web browser windows to https://<hostname>
- The jenkins login page appears
- Select the certificate from the browser and view its details to make sure it is the certificate that was defined in step 3
Optional: Delete the NodePort to prevent HTTP access to the server
At this point the jenkins server is exposed over HTTP and HTTPS at our external hostname. The ingress was used to expose the jenkins application over HTTPS. The service created by the deployment exposes jenkins over HTTP. Follow these steps to remove the HTTP access defined in the service.
- Using the command window, run this command to edit the service:
kubectl edit service -n dev-deploys dev-jenkins-ibm-jenkins
Change the dev-deploys namespace and the dev-jenkins-ibm-jenkins values shown above to your namespace and helm chart service name respectively.
- Change the value of the type field from NodePort to ClusterIP
- Delete the lines containing a nodePort field.
Example: nodePort: 31714
- Save and quit the edit session
Follow the steps below to make sure the service type was changed to ClusterIP successfully.
- From the IBM Cloud Private web console, select the Workloads menu entry and select Helm Release.
- Find the release you deployed for this sample and select the link for the release name.
- Click the link under Service and make sure the Type is ClusterIP.
- Using the command window, run this command to edit the service: