This is a part of the series of posts on Getting memcache up and running on Kubernetes which explained how to create your first cluster. I recommend that you save your commands in various scripts so you can repeat them or modify them later.
Installing helm and tiller
Helm (client side) and Tiller (server side) are used to install preconfigured kubernetes containers on a cluster. This simplifies the setup significantly and in the case of memcache, makes it trivial. First up you have to give permission for tiller to run in your cluster in the system namespace.
kubectl create serviceaccount --namespace kube-system tiller kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
Helm installs Tiller, and you can get and initiliaze it like this.
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash helm init
Permissions
Later on you’ll likely hit permission issues when you try to deploy memcached, so we’ll assign the role we created earlier to tiller, and update the initialization like this.
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' helm init --service-account tiller --upgrade
Installing memcached
Helm will take care of the installation details and getting the latest memcached container from its repository. Here I’m running 3 memcached replicas.
helm install stable/memcached --name mycache --set replicaCount=3
You’ll get a bunch of information during the installation process, but when it’s all over you’ll be able to see these 3 pods.
kubectl get pods NAME READY STATUS RESTARTS AGE mycache-memcached-0 1/1 Running 0 4m mycache-memcached-1 1/1 Running 0 3m mycache-memcached-2 1/1 Running 0 2m
Next step
See Exposing a memcache loadbalancer