Setup a ip ro workaround for cluste IPs
This commit is contained in:
parent
6ec957a255
commit
21f1c82fb0
2 changed files with 7 additions and 7 deletions
|
@ -27,5 +27,5 @@ if [ "$deploy_res" -eq "0" ]; then
|
||||||
echo "Setting up kubedashboard..."
|
echo "Setting up kubedashboard..."
|
||||||
ansible-playbook -i $INVENTORY playbooks/kubedashboard.yaml
|
ansible-playbook -i $INVENTORY playbooks/kubedashboard.yaml
|
||||||
echo "Setting up ip route work-around for DNS clusterIP availability..."
|
echo "Setting up ip route work-around for DNS clusterIP availability..."
|
||||||
ansible-playbook -i $INVENTORY playbooks/ipro_for_dnsmasq.yaml
|
ansible-playbook -i $INVENTORY playbooks/ipro_for_cluster_ips.yaml
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# FXIME: add persistent routing rule
|
# FXIME: add persistent routing rule
|
||||||
- hosts: kube-master
|
- hosts: kube-master
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get DNS clusterIP
|
- name: Get kube service net
|
||||||
shell: kubectl get svc --namespace kube-system dnsmasq --template=\{\{.spec.clusterIP\}\}
|
shell: grep KUBE_SERVICE_ADDRESSES /etc/kubernetes/kube-apiserver.env | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}\b"
|
||||||
register: dnsmasq_ip
|
register: kube_service_addresses
|
||||||
run_once: true
|
run_once: true
|
||||||
- hosts: all
|
- hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
|
@ -11,11 +11,11 @@
|
||||||
shell: "calicoctl status | grep IP: | awk '{print $2}'"
|
shell: "calicoctl status | grep IP: | awk '{print $2}'"
|
||||||
register: local_ip
|
register: local_ip
|
||||||
- name: Get route
|
- name: Get route
|
||||||
shell: ip ro ls | grep "^{{ hostvars[groups['kube-master'][0]]['dnsmasq_ip']['stdout'] }}" || echo ""
|
shell: ip ro ls | grep "^{{ hostvars[groups['kube-master'][0]]['kube_service_addresses']['stdout'] }}" || echo ""
|
||||||
register: local_route
|
register: local_route
|
||||||
- name: Clean up route
|
- name: Clean up route
|
||||||
shell: ip ro del {{ hostvars[groups['kube-master'][0]]['dnsmasq_ip']['stdout'] }} || true
|
shell: ip ro del {{ hostvars[groups['kube-master'][0]]['kube_service_addresses']['stdout'] }} || true
|
||||||
when: local_route.stdout.find('{{ local_ip.stdout }}') == -1
|
when: local_route.stdout.find('{{ local_ip.stdout }}') == -1
|
||||||
- name: Setup route
|
- name: Setup route
|
||||||
shell: ip ro add {{ hostvars[groups['kube-master'][0]]['dnsmasq_ip']['stdout'] }} via {{ local_ip.stdout }}
|
shell: ip ro add {{ hostvars[groups['kube-master'][0]]['kube_service_addresses']['stdout'] }} via {{ local_ip.stdout }}
|
||||||
when: local_route.stdout.find('{{ local_ip.stdout }}') == -1
|
when: local_route.stdout.find('{{ local_ip.stdout }}') == -1
|
Loading…
Reference in a new issue