Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

192 lines (129 sloc) 4.79 KB

Deploy to IBM Cloud

Create a Kubernetes cluster


Click on shopping-cluster to view:


Set up CLI for IBM Cloud

Connect to IBM Cloud with CLI

If this is your first time connecting to an IBM Cloud cluster, see the full setup directions.


Set up helm

kubectl create serviceaccount tiller -n kube-system
kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller -n kube-system
kubectl get serviceaccount -n kube-system tiller
helm init --service-account tiller

Set up IBM Cloud container registry

Upload images to IBM Cloud container registry

  1. Login into IBM Cloud container registry
ibmcloud cr login
  1. Use an existing namespace for the container registry or create a new one:

In sections below, we assume the namespace is loopback. Please substitute loopback to the container registry namespace you choose for IBM Cloud.

Existing namespaces can be listed:

ibmcloud cr namespaces

You can add a namespace as follows:

ibmcloud cr namespace-add loopback
  1. Upload docker images
  • Build docker images locally

Before we rebuild docker images, consider to bump the project to the next version:

npm run docker:version

To specify the exact version:

npm run docker:version -- <version>

Run the the following command to build docker images:

npm run docker:build
  • Tag and push images to IBM Cloud container registry
docker tag loopback4-example-shopping:1.1.1
docker push

docker tag loopback4-example-recommender:1.1.1
docker push

Please note that the fully qualified docker image name is in the form of <registry>/<namespace>/<repository>:<tag>. For example, represents the following:

  • registry -
  • namespace - loopback
  • repository - loopback-example-shopping
  • tag - 1.1.0

Install the helm chart

  1. Update kubernetes/shopping-app/ibmcloud-values.yaml:
  1. Build the helm chart with dependencies
helm dependency build kubernetes/shopping-app
  1. Install the helm chart to IBM Cloud
helm install --name shopping-app -f kubernetes/shopping-app/ibmcloud-values.yaml kubernetes/shopping-app/

If you have an existing release named as shopping-app, use the following command to uninstall it:

helm del --purge shopping-app

Open the kubernetes dashboard


Access the home page for the shopping application

A few steps are involved to find the public URL of the application:

  1. Get the public IP of the k8s cluster

    ibmcloud ks worker ls shopping-cluster

    Sample output:

    ID                                                       Public IP       Private IP     Flavor   State    Status   Zone    Version
    kube-bm5qug9d04ikneuepcj0-shoppingclu-default-0000003e   free     normal   Ready    hou02   1.14.6_1533*

    In the example above, the public ip is

  2. Get the NodePort for shopping service

    kubectl describe services shopping

    Sample output:

    Name:                     shopping
    Namespace:                default
    Labels:                   service=shopping
    Annotations:              <none>
    Selector:                 service=shopping
    Type:                     NodePort
    Port:                     rest  3000/TCP
    TargetPort:               rest/TCP
    NodePort:                 rest  31094/TCP     <= Public Port is 31094
    Session Affinity:         None
    External Traffic Policy:  Cluster
    Events:                   <none>

    In this example, the public port is 31094 as NodePort: rest 31094/TCP maps 31094 to 3000.

  3. Open the home page


    In the example output, the public url is

You can’t perform that action at this time.