Helm is the package manager for Kubernetes. With Helm, you can very easily deploy applications, tools, and databases like MongoDB, PostgreSQL, WordPress, and Apache Spark into your own Kubernetes clusters. Below is a brief description of how to use Helm for the IBM Cloud Container service.
“Helm helps you manage Kubernetes applications. Helm Charts helps you define, install, and upgrade even the most complex Kubernetes application. Charts are easy to create, version, share, and publish, so start using Helm and stop the copy-and-paste madness. The latest version of Helm is maintained by the CNCF.”
You can easily install applications by invoking commands like ‘helm install stable/mongodb’. You can also configure applications before installing them via YAML configuration files.
Below is a quick example for how to deploy MongoDB to Kubernetes on the IBM Cloud.
First, you need to configure the Bluemix CLI to work against your Kubernetes cluster, and you need to install Helm on your development machine.
bx login -a https://api.ng.bluemix.net bx target --cf bx cs init bx cs cluster-config mycluster set environment variable: export KUBECONFIG=... bx cr login helm init helm repo add stable https://kubernetes-charts.storage.googleapis.com/
Next, you can install Kubernetes applications with the following command:
helm install --name my-tag stable/mongodb
If you want to delete everything later, run ‘helm delete my-tag’.
To find out the IP address and port, run these commands:
bx cs workers mycluster kubectl get svc kubectl get svc my-service
If you have a paid account, this is all you have to do.
The free account does not support persistent volumes. As a workaround (not for production) you can use disk space on worker nodes. Run ‘kubectl create -f config.yaml’ with the following content in config.yaml for MongoDB.
kind: PersistentVolume apiVersion: v1 metadata: name: mongo-simple-mongodb namespace: default spec: capacity: storage: 10Gi accessModes: - ReadWriteOnce hostPath: path: "/tmp/data"
After this, you can see everything working on the Kubernetes dashboard (‘kubectl proxy’).