You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.2 KiB

9 years ago
  1. ---
  2. - import_tasks: facts.yml
  3. tags:
  4. - facts
  5. - import_tasks: pre_upgrade.yml
  6. tags:
  7. - kubelet
  8. - name: Ensure /var/lib/cni exists
  9. file:
  10. path: /var/lib/cni
  11. state: directory
  12. mode: 0755
  13. - import_tasks: install.yml
  14. tags:
  15. - kubelet
  16. - import_tasks: nginx-proxy.yml
  17. when: is_kube_master == false and loadbalancer_apiserver_localhost
  18. tags:
  19. - nginx
  20. - name: Write kubelet config file (non-kubeadm)
  21. template:
  22. src: kubelet.standard.env.j2
  23. dest: "{{ kube_config_dir }}/kubelet.env"
  24. backup: yes
  25. when: not kubeadm_enabled
  26. notify: restart kubelet
  27. tags:
  28. - kubelet
  29. - name: Write kubelet config file (kubeadm)
  30. template:
  31. src: kubelet.kubeadm.env.j2
  32. dest: "{{ kube_config_dir }}/kubelet.env"
  33. backup: yes
  34. when: kubeadm_enabled
  35. notify: restart kubelet
  36. tags:
  37. - kubelet
  38. - kubeadm
  39. - name: write the kubecfg (auth) file for kubelet
  40. template:
  41. src: "{{ item }}-kubeconfig.yaml.j2"
  42. dest: "{{ kube_config_dir }}/{{ item }}-kubeconfig.yaml"
  43. backup: yes
  44. with_items:
  45. - node
  46. - kube-proxy
  47. when: not kubeadm_enabled
  48. notify: restart kubelet
  49. tags:
  50. - kubelet
  51. - name: Ensure nodePort range is reserved
  52. sysctl:
  53. name: net.ipv4.ip_local_reserved_ports
  54. value: "{{ kube_apiserver_node_port_range }}"
  55. sysctl_set: yes
  56. state: present
  57. reload: yes
  58. when: kube_apiserver_node_port_range is defined
  59. tags:
  60. - kube-proxy
  61. - name: Verify if br_netfilter module exists
  62. shell: "modinfo br_netfilter"
  63. register: modinfo_br_netfilter
  64. failed_when: modinfo_br_netfilter.rc not in [0, 1]
  65. changed_when: false
  66. - name: Enable br_netfilter module
  67. modprobe:
  68. name: br_netfilter
  69. state: present
  70. when: modinfo_br_netfilter.rc == 0
  71. - name: Persist br_netfilter module
  72. copy:
  73. dest: /etc/modules-load.d/kubespray-br_netfilter.conf
  74. content: br_netfilter
  75. when: modinfo_br_netfilter.rc == 0
  76. # kube-proxy needs net.bridge.bridge-nf-call-iptables enabled when found if br_netfilter is not a module
  77. - name: Check if bridge-nf-call-iptables key exists
  78. command: "sysctl net.bridge.bridge-nf-call-iptables"
  79. failed_when: false
  80. changed_when: false
  81. register: sysctl_bridge_nf_call_iptables
  82. - name: Enable bridge-nf-call tables
  83. sysctl:
  84. name: "{{ item }}"
  85. state: present
  86. value: 1
  87. reload: yes
  88. when: modinfo_br_netfilter.rc == 1 and sysctl_bridge_nf_call_iptables.rc == 0
  89. with_items:
  90. - net.bridge.bridge-nf-call-iptables
  91. - net.bridge.bridge-nf-call-arptables
  92. - net.bridge.bridge-nf-call-ip6tables
  93. - name: Modprode Kernel Module for IPVS
  94. modprobe:
  95. name: "{{ item }}"
  96. state: present
  97. when: kube_proxy_mode == 'ipvs'
  98. with_items:
  99. - ip_vs
  100. - ip_vs_rr
  101. - ip_vs_wrr
  102. - ip_vs_sh
  103. - nf_conntrack_ipv4
  104. tags:
  105. - kube-proxy
  106. - name: Write proxy manifest
  107. template:
  108. src: manifests/kube-proxy.manifest.j2
  109. dest: "{{ kube_manifest_dir }}/kube-proxy.manifest"
  110. when: not kubeadm_enabled
  111. tags:
  112. - kube-proxy
  113. - name: Purge proxy manifest for kubeadm
  114. file:
  115. path: "{{ kube_manifest_dir }}/kube-proxy.manifest"
  116. state: absent
  117. when: kubeadm_enabled
  118. tags:
  119. - kube-proxy
  120. # reload-systemd
  121. - meta: flush_handlers
  122. - name: Enable kubelet
  123. service:
  124. name: kubelet
  125. enabled: yes
  126. state: started
  127. tags:
  128. - kubelet