Installing Kubernetes
I used Kubeadm as I alluded to in a previous post. The one tricky part is making sure that you have the pod-network-cidr explicitly specified when running kubeinit. In addition to turning off swap etc. I had no need to turn off/disable firewall, some people say they had to.
Installing ElasticSearch
So to test my new Kubernetes cluster, I wanted to play with elasticsearch. The instructions for that are relatively straightforward here https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-eck.html . Once the custom resource definition is installed, I started using the snippet here https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-elasticsearch.html to deploy a quick-start elasticsearch cluster, easy enough I thought. Keep in mind this isn't on a cloud based environment, this is going to be on dev kubernetes.
ElasticSearch Didn't Find Storage -- Persistent Volumes
After I deployed my quickstart ES cluster, I saw the following error: "0/3 nodes are available: 3 pod has unbound immediate PersistentVolumeClaims". So essentially ES pods want to claim storage space (persistent volume) but don't know how. So I followed the following steps to resolve the issue:
- Created a storage class, I used a local storage class since I don't have NFS setup yet, see https://kubernetes.io/docs/concepts/storage/storage-classes/#local
- I created a persistent volume with the same storage class as the local one I just created
- I had to tweak the quickstart ES cluster template to:
- modify the volumeClaimTemplate to have it use the PersistentVolume I created in step 2
- modify the pod template to have the pod scheduled on a specific node that has persistent volume (remember this is a local storage)
- ES requires vm.max_map_count to be >= 262144
- I deployed the three objects and I finally had ES up and running
Scripts
Local Storage
Persistent Volume