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.

59 lines
1.8 KiB

  1. ---
  2. - name: Kubernetes Apps | Wait for kube-apiserver
  3. uri:
  4. url: "{{ kube_apiserver_endpoint }}/healthz"
  5. validate_certs: no
  6. client_cert: "{{ kube_apiserver_client_cert }}"
  7. client_key: "{{ kube_apiserver_client_key }}"
  8. register: result
  9. until: result.status == 200
  10. retries: 10
  11. delay: 6
  12. when: inventory_hostname == groups['kube-master'][0]
  13. - name: Kubernetes Apps | Add ClusterRoleBinding to admit nodes
  14. template:
  15. src: "node-crb.yml.j2"
  16. dest: "{{ kube_config_dir }}/node-crb.yml"
  17. register: node_crb_manifest
  18. when: rbac_enabled
  19. - name: Apply workaround to allow all nodes with cert O=system:nodes to register
  20. kube:
  21. name: "system:node"
  22. kubectl: "{{bin_dir}}/kubectl"
  23. resource: "clusterrolebinding"
  24. filename: "{{ kube_config_dir }}/node-crb.yml"
  25. state: latest
  26. when:
  27. - rbac_enabled
  28. - node_crb_manifest.changed
  29. # This is not a cluster role, but should be run after kubeconfig is set on master
  30. - name: Write kube system namespace manifest
  31. template:
  32. src: namespace.j2
  33. dest: "{{kube_config_dir}}/{{system_namespace}}-ns.yml"
  34. when: inventory_hostname == groups['kube-master'][0]
  35. tags:
  36. - apps
  37. - name: Check if kube system namespace exists
  38. command: "{{ bin_dir }}/kubectl get ns {{system_namespace}}"
  39. register: 'kubesystem'
  40. changed_when: False
  41. failed_when: False
  42. when: inventory_hostname == groups['kube-master'][0]
  43. tags:
  44. - apps
  45. - name: Create kube system namespace
  46. command: "{{ bin_dir }}/kubectl create -f {{kube_config_dir}}/{{system_namespace}}-ns.yml"
  47. retries: 4
  48. delay: "{{ retry_stagger | random + 3 }}"
  49. register: create_system_ns
  50. until: create_system_ns.rc == 0
  51. changed_when: False
  52. when: inventory_hostname == groups['kube-master'][0] and kubesystem.rc != 0
  53. tags:
  54. - apps