Skip to content

Instantly share code, notes, and snippets.

@wknapik
Created November 3, 2017 12:04
Show Gist options
  • Save wknapik/3b93d93053de458fbc2114cd5a7199b6 to your computer and use it in GitHub Desktop.
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
- 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 }}"
@jxsl13
Copy link

jxsl13 commented May 27, 2021

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment