Created
November 3, 2017 12:04
-
-
Save wknapik/3b93d93053de458fbc2114cd5a7199b6 to your computer and use it in GitHub Desktop.
Set up a tunnel to tiller to use with the ansible helm module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- set_fact: | |
tun_pid_file: ... | |
- name: set up a tunnel to tiller | |
shell: | | |
tiller_pod="$(kubectl get pod -l app=helm,name=tiller --namespace kube-system -o name|cut -d/ -f2)" | |
nohup kubectl port-forward "$tiller_pod" 44134:44134 --namespace kube-system </dev/null >/dev/null 2>&1 & | |
echo "$!" >{{ tun_pid_file|quote }} | |
creates: "{{ tun_pid_file }}" | |
- helm: ... | |
- name: tear down the tunnel to tiller | |
shell: | | |
kill "$(cat {{ tun_pid_file|quote }})" || true | |
rm -f {{ tun_pid_file|quote }} | |
removes: "{{ tun_pid_file }}" |
Just stumbled upon with this after two days without understand why helm Ansible module is not working.
This saved my day. This should be on Ansible official repository!
thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The port-forward is supposed to be ran locally, in your computer. It creates a tunnel to bind your local port 44134 to remote tiller's 44134 port. Then you just launch ansible on localhost.
To test it out you can just run in the terminal this command and then launch the ansible playbook and it will work:
nohup kubectl port-forward $(kubectl get pod -l app=helm,name=tiller --namespace kube-system -o name|cut -d/ -f2) 44134 -n kube-system &