Follow these instructions to deploy this application to a Kubernetes cluster and connect it with a Cloudant database.
git clone https://github.com/IBM-Cloud/get-started-node
cd get-started-node
-
Find your container registry namespace by running
ibmcloud cr namespaces
. If you don't have any, create one usingibmcloud cr namespace-add <name>
-
Identify your Container Registry by running
ibmcloud cr info
(Ex: registry.ng.bluemix.net) -
Build and tag (
-t
)the docker image by running the command below replacing REGISTRY and NAMESPACE with he appropriate values.docker build . -t <REGISTRY>/<NAMESPACE>/myapp:v1.1.0
Example:
docker build . -t registry.ng.bluemix.net/mynamespace/myapp:v1.1.0
-
Push the docker image to your Container Registry on IBM Cloud
docker push <REGISTRY>/<NAMESPACE>/myapp:v1.1.0
- Creating a Kubernetes cluster in IBM Cloud.
- Follow the instructions in the Access tab to set up your
kubectl
cli.
-
Go to the Catalog and create a new Cloudant database instance.
-
Choose
IAM
for Authentication. -
Create new credentials under Service Credentials and copy value of the url field.
-
Create a Kubernetes secret with your Cloudant credentials.
kubectl create secret generic cloudant --from-literal=url=<URL> --from-literal=iamApiKey=<IAM_API_KEY>
Example:
kubectl create secret generic cloudant --from-literal=url=https://xxxxx-yyyy-zzz-eeeee-ddddddd-bluemix.cloudantnosqldb.appdomain.cloud --from-literal=iamApiKey=xxxxxx-ddd-ppppppppppp
- Replace
<REGISTRY>
and<NAMESPACE>
with the appropriate values inkubernetes/deployment.yaml
- Create a deployment:
kubectl create -f kubernetes/deployment.yaml
-
Paid Cluster: Expose the service using an External IP and Loadbalancer
kubectl expose deployment get-started-node --type LoadBalancer --port 8080 --target-port 8080
-
Free Cluster: Use the Worker IP and NodePort
kubectl expose deployment get-started-node --type NodePort --port 8080 --target-port 8080
Verify STATUS of pod is RUNNING
kubectl get pods -l app=get-started-node
Standard (Paid) Cluster:
- Identify your LoadBalancer Ingress IP using
kubectl get service get-started-node
- Access your application at t
http://<EXTERNAL-IP>:8080/
Free Cluster:
- Identify your Worker Public IP using
ibmcloud cs workers YOUR_CLUSTER_NAME
- Identify the Node Port using
kubectl describe service get-started-node
- Access your application at
http://<WORKER-PUBLIC-IP>:<NODE-PORT>/
kubectl delete deployment,service -l app=get-started-node
kubectl delete secret cloudant