Helm on Docker Kubernetes for Local Development
I wanted to test and learn more about Helm configurations. This article is about how I achieved a good development environment for this. Please do note that this is mostly for Mac, however I will have add some notes about possible Windows implementations at the end of the article.
Installing Kubernetes
I initially started out with minikube however one thing I really didn't like was the performance of minikube. No matter what I tried minikube would at times die and would require me to restart the minikube service.
So instead I decided to go with Docker-Kubernetes solution. After Docker gave in to the Kubernetes orchestration tooling they added a very good implementation of kubernetes to their docker desktop solution. Installing it is pretty simple. You would need to follow Docker's instructions. It is pretty long. Not adding it here.
Installing kubectl
Installing kubectl can be done via Homebrew. Simply install homebrew and install kubectl with the following commands:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install kubernetes-cli
Setup kubernetes dashboard
You would need to do the following steps to ensure you have a Kubernetes dashboard which makes some management aspects a little simpler. You can for go this if you believe you have a very well understanding of kubectl commands.
$ kubectl cluster-info # Make sure that your cluster is running and setup
$ kubectl config current-context # Make sure that the context is also setup correctly
$ kubectl create -f kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
$ kubectl get pods --namespace=kube-system | grep kubernetes-dashboard
$ kubectl port-forward kubernetes-dashboard-<some-id> 8443:8443 --namespace=kube-system
You should be able to access the dashboard now from https://127.0.0.1:8443. Please note the https at the beginning of the address.
We will probably want to create a service for this to make things a little bit easier. Please note that you shouldn't do this on a production cluster. 😊
Save the code below in a file named kubernetes-dashboard-service.yml
kind: Service
apiVersion: v1
metadata:
name: kubernetes-dashboard-service
namespace: kube-system
spec:
selector:
k8s-app: kubernetes-dashboard
ports:
- protocol: TCP
port: 8443
targetPort: 8443
type: LoadBalancer
You might want to change "port" here if you already have or thinking of having a service that uses 8443.
Run the following command to make sure kubernetes gets the required configuration:
$ kubectl apply -f kubernetest-dashboard-service.yml
Installing Helm
Installing helm is pretty straight forward. Run the following command below:
brew install kubernetes-helm
This would have installed the helm client. Now to make sure that your kubernetes cluster has helm simply run the following:
helm init
You can test your helm installation with running helms preferred quick start example:
helm install stable/mysql
And now you should have mysql installed!
Notes for Windows users
The biggest issue with windows is users is that at this time there isn't a way to install docker-kubernetes on a windows box at this time. Windows users will need to use minikube. Make sure to increase your memory setup for minikube for slightly better perfomance.
Conclusion
Install and learn helm!! It is fun!
Have fun!