So I moved to DigitalOcean for hosting of the Votavi platform infrastructure. This will also be the place where the production hosting will start. DigitalOcean has a couple of advantages. Hourly hosting, which will make scaling up and down, temporary resources for testing, upgrading the cluster etc etc much more cost efficient.
But much more important is the block storage which can be enabled on Kubernetes. So here a little tutorial on how to do that;
- To enable Kubernetes to dynamically create Volumes based on VolumeClaim requests (Persistent Volume in Kubernetes), you will need an API key from DigitalOcean, you can create one here (if you have a DigitalOcean account).
- Base64 the token (on commandline echo -n <api-token> | base64), and insert it into manifests/digitalocean-secret.yaml . Apply the yaml file to your Kubernetes cluster (via kubectl or the dashboard).
- Now load the RBAC files into your cluster (RBAC) , since this implementation is based on Kubernetes 1.9/1.10 I make the assumption Role-Based Access Control is used.
- So for the next step we need the provisioner which will handle the communication to the DigitalOcean API (provisioner ) , and load it into your cluster.
- Ok for this step we need to adjust the yaml file. This file creates the Deamonset on your cluster so every node can mount the DigitalOcean block storage volumes. Edit the host path in the file so it matches your environment, for me the default path was fine (Kubeadm installation on Debian 9 servers). Now load the file into your cluster.
- For the final step. Take the StorageClass yaml file , edit the Digital Ocean zone so it is in the same zone as your servers are, now block storage can be attached to them. You can adjust the Storage Class name if you want, I keep it on ‘default’. Load the file into your cluster and you are ready. You now have your Kubernetes Cluster running with dynamically allocated DigitalOcean Block Storage 😀 .
You can create your first volumeclaim as explained in Persistent Volumes in Kubernetes. After creating a volumeclaim you should see the volume in the DigitalOcean dashboard next to droplets in the volumes tab. This volume can now be mounted by a Kubernetes Pod via its Kubernetes claimName .