How to deploy IBM API Connect using command-line

Introduction

After you install Cloud Pak for Integration, you get a nice Platform Navigator, where you can deploy the Cloud Pak for Integration components. From there, you can click the “Add new instance” button, fill the parameters, and deploy the component.

Step-by-Step Procedure

In this tutorial, I will deploy API Connect to the apic project. To make life easier, let’s define the following environment variables:

export PROJECT=apic
export ICP_PASSWORD=<your ICP password>
export NAME=<name of the API Connect instance>

Log on to your OpenShift cluster

The first thing I need to do is to log on to OpenShift, using oc login

Obtain ICP Master URL

Run the following command to set the MASTER_URL environment variable:

export MASTER_URL=https://$(oc get route icp-console -n kube-system -o jsonpath='{@.status.ingress[0].host}')

Configure Helm CLI

Next, I need to configure the Helm CLI. Run the following command:

cloudctl login -a $MASTER_URL -u admin -p $ICP_PASSWORD -n kube-system --skip-ssl-validation

Re-login to OpenShift cluster

After configuring the Helm CLI, we need to re-login to the OpenShift cluster, by running oc login again.

oc status
helm list --tls

Create the Role Binding

Now, that I configured the CLIs, I can proceed to create the necessary artifacts.

oc -n $PROJECT create rolebinding apic-security-policy \
--clusterrole=ibm-anyuid-hostpath-scc \
--group=system:serviceaccounts:$PROJECT

Create the TLS Secret

Next, we need to create the TLS Secret, by running the following command:

oc create secret generic helm-tls-secret \
--from-file=cert.pem=$HOME/.helm/cert.pem \
--from-file=ca.pem=$HOME/.helm/ca.pem \
--from-file=key.pem=$HOME/.helm/key.pem

Obtain the ICP Proxy route

I now need to obtain the route for the ICP proxy:

export ROUTE=$(oc get route icp-proxy -n kube-system -o jsonpath='{@.status.ingress[0].host}')

Create the Helm Values file

Ok, I am almost there. We are at the final step before deploying is to configure the Helm values file.

curl https://raw.githubusercontent.com/patrocinio/cloud-paks-resilience/master/Integration/values.yaml.template | sed s/\$ROUTE/$ROUTE/g > /tmp/values.yaml

Deploy the Helm chart

I am finally ready to deploy the API Connect Helm chart.

helm install https://github.com/IBM/charts/raw/master/repo/entitled/ibm-apiconnect-icp4i-prod-1.0.3.tgz \
--name $NAME --tls -f /tmp/values.yaml

Automating the process to deploy API Connect

The process below was straightforward, but incurred in many steps. I promised to give a simple way to deploy API Connect, so let’s look a script that does it all.

git clone https://github.com/patrocinio/cloud-paks-resilience.git
cd cloud-paks-resilience/Integration
./deploy_apic.sh <API Connect instance name>

Conclusion

In this blog, I showed how to deploy an instance of API Connect, as part of the Cloud Pak for Integration.

--

--

Principal Solutions Architect, Strategic Accounts, AWS

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store