Deploying to IBM Cloud Private with IBM Cloud Developer Tools CLI
NOTE: For IBM Cloud Private 220.127.116.11, please see this article with instructions for that version.
IBM Cloud Private is an application platform for developing and managing on-premises, containerized applications. It is an integrated environment for managing containers that includes the container orchestrator Kubernetes, a private image repository, a management console, and monitoring frameworks.
The recent promotion of the IBM Cloud Developer Tools to 1.0 introduced support for Kubernetesdeployments. This support is not just to the Kubernetes environment on the public IBM Cloud; it also supports IBM Cloud Private (formerly known as Spectrum Conductor for Containers). This means that you can use the the IBM Cloud Developer Tools CLI to generate starter applications and also perform deployments to your IBM Cloud Private environments.
To install the IBM Cloud Developer Tools, follow these instructions. Once installed, ensure your Helm version is appropriate for your IBM Cloud Private environment. To get a particular Helm version, for example to install Helm for use with IBM Cloud Private 2.1 use:
Complete these commands:
Download and install the binary at https://github.com/kubernetes/helm/releases/tag/v2.6.0
Deploying to IBM Cloud Private
First things first, you need to create a starter application to deploy, using the
bx dev create command. Follow the prompts, and select the pattern/language/starter that you’d like to use. I recommend either the Node.js or Java Basic Web starters – they are simple and easy to follow, but feel free to choose any language or starter. Once it is created,
cd into the new directory on your system. You can also enable an existing application for Kubernetes deployment using the
bx dev enable
Once you have an application, you need to configure your local machine to push to the IBM Cloud Private environment.
Configure Docker Registry Access
First, create an entry in your hosts file that maps to
This is added in
/etc/hosts on MacOS and Linux, or
C:\Windows\System32\drivers\etc\hosts on Windows.
Next we need to add the registry
mycluster.icp:8500 for IBM Cloud Private to the list of insecure Docker registries on your local machine. Instructions by operating system platform are found here.
Finally, log in to the the IBM Cloud Private Docker registry, using the appropriate user and password from your server, and using the hostname you defined above:
There are a couple commands to ensure both the kubectl client and the Kubernetes service account are ready for deployment.
Configure kubectl for access
In the IBM Cloud Private management console, click on your user name in the top right corner, and then select the “Configure client” option.
To ensure that the credentials for your client are valid, you should complete a fresh login to the IBM Cloud Private management console. If you need help logging into IBM Cloud Private, see these instructions. “Configure client” will provide a set of commands like the following example, that you then run on your local system:
Configure the service account
Next, you’ll configure the service account in IBM Cloud Private with the image pull secret. This enables Kubernetes to pull images from the private registry. Two techniques are provided, in both cases:
the user for the secret must be a user associated with the namespace to which you will deploy
you must have logged in to IBM Cloud Private previously with this user
The first technique is to edit the serviceaccounts directly with
kubectl edit serviceaccounts and add or update this section, substituting <the user> with your user:
The second technique uses jq, which can be installed using brew (Mac), yum (RedHat Linux) or apt (Ubuntu Linux).
Where “admin” is your user account associated with the namespace to which you will be deploying, and that you have used to login to IBM Cloud Private, previously. Upon completion of jq, you will see an entry for the serviceaccount is noted as “replaced.”
Deploy an App
For the simplest deploy experience, you can update your application’s
cli-config.yml file to point to the IBM Cloud Private Kubernetes environment by adding these entries:
The <Namespace> is the namespace on IBM Cloud Private to which you are deploying, for example
default. <App-Name> is the name of your application deployment.
deploy-target value instructs the CLI to target a Kubernetes/container environment, and the
deploy-image-target value tells the CLI what to tag your image with for the IBM Cloud Private registry. Note that if you do not update the
cli-config.yml, you will need to specify
-t container for the deploy command below, and then the deploy action will query you for the
Tip: for public IBM Cloud users, you must execute
bx logoutbefore you deploy to IBM Cloud Private
You’re now ready to deploy your Kubernetes application to the IBM Cloud Private environment. Just use the deploy command to kick off the deployment:
In this case, the deploy command will:
Build and upload the Docker image of your application to the IBM Cloud Private image repository
Perform a deployment to your IBM Cloud Private Kubernetes cluster using the Helm chart that was generated by the
bx dev createor
bx dev enablecommand.
…and now you have generated and deployed your first application to IBM Cloud Private using the IBM Cloud Developer Tools CLI.