kubernetes install helm tiller code example

Example: installing helm v2 and tiller on minikube

#installing helm
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > install-helm.sh
bash install-helm.sh

#Create the Tiller service account
kubectl create serviceaccount tiller --namespace kube-system
#Bind the Tiller service account to the cluster-admin role
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
#initialisr helm with service account "tiller"
helm init --service-account tiller

#sharing YAML file to bind tiller service account to cluster-admin role
#Yo can use this YAML file if you do not want to do binding with command
# and want to know further.
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: tiller-clusterrolebinding
subjects:
- kind: ServiceAccount
  name: tiller
  namespace: kube-system
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: ""