summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/control-plane/tasks/net_kube-router.yml
blob: dcf737ae7b6ffba0e27cb47485db6b978c60d647 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: generate kube-router configuration
  template:
    src: "net_kube-router/config.{{ kubernetes_network_plugin_version }}.yml.j2"
    dest: /etc/kubernetes/network-plugin/config.yml

- name: check if kube-router is already installed
  check_mode: no
  command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/network-plugin/config.yml
  failed_when: false
  changed_when: false
  register: kube_router_diff_result

- name: install kube-router onto the cluster
  when: kube_router_diff_result.rc != 0
  command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/network-plugin/config.yml


- name: install node-local dns cache
  when: kubernetes_enable_nodelocal_dnscache
  block:
  - name: generate node-local dns cache config
    template:
      src: net_kube-router/node-local-dns.yml.j2
      dest: /etc/kubernetes/network-plugin/node-local-dns.yml

  - name: check if node-local dns cache is already installed
    check_mode: no
    command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/network-plugin/node-local-dns.yml
    failed_when: false
    changed_when: false
    register: kube_node_local_dns_diff_result

  - name: install node-local dns cache
    when: kube_node_local_dns_diff_result.rc != 0
    command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/network-plugin/node-local-dns.yml