2017-10-26 08:10:33 +00:00
|
|
|
---
|
|
|
|
- name: Kubernetes Apps | Wait for kube-apiserver
|
|
|
|
uri:
|
2017-11-06 20:01:10 +00:00
|
|
|
url: "{{ kube_apiserver_endpoint }}/healthz"
|
|
|
|
validate_certs: no
|
|
|
|
client_cert: "{{ kube_apiserver_client_cert }}"
|
|
|
|
client_key: "{{ kube_apiserver_client_key }}"
|
2017-10-26 08:10:33 +00:00
|
|
|
register: result
|
|
|
|
until: result.status == 200
|
|
|
|
retries: 10
|
|
|
|
delay: 6
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2017-10-26 08:10:33 +00:00
|
|
|
|
|
|
|
- name: Kubernetes Apps | Add ClusterRoleBinding to admit nodes
|
|
|
|
template:
|
|
|
|
src: "node-crb.yml.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/node-crb.yml"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0640
|
2017-10-26 08:10:33 +00:00
|
|
|
register: node_crb_manifest
|
2018-03-18 15:15:00 +00:00
|
|
|
when:
|
|
|
|
- rbac_enabled
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2017-10-26 08:10:33 +00:00
|
|
|
|
|
|
|
- name: Apply workaround to allow all nodes with cert O=system:nodes to register
|
|
|
|
kube:
|
2018-03-09 05:56:46 +00:00
|
|
|
name: "kubespray:system:node"
|
2019-05-02 21:24:21 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2017-10-26 08:10:33 +00:00
|
|
|
resource: "clusterrolebinding"
|
|
|
|
filename: "{{ kube_config_dir }}/node-crb.yml"
|
|
|
|
state: latest
|
2019-02-25 06:50:55 +00:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
|
|
|
retries: 10
|
|
|
|
delay: 6
|
2017-10-26 08:10:33 +00:00
|
|
|
when:
|
|
|
|
- rbac_enabled
|
|
|
|
- node_crb_manifest.changed
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2017-10-26 08:10:33 +00:00
|
|
|
|
2018-01-21 10:34:37 +00:00
|
|
|
- name: Kubernetes Apps | Add webhook ClusterRole that grants access to proxy, stats, log, spec, and metrics on a kubelet
|
|
|
|
template:
|
|
|
|
src: "node-webhook-cr.yml.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/node-webhook-cr.yml"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0640
|
2018-01-21 10:34:37 +00:00
|
|
|
register: node_webhook_cr_manifest
|
|
|
|
when:
|
|
|
|
- rbac_enabled
|
|
|
|
- kubelet_authorization_mode_webhook
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-01-21 10:34:37 +00:00
|
|
|
tags: node-webhook
|
|
|
|
|
|
|
|
- name: Apply webhook ClusterRole
|
|
|
|
kube:
|
|
|
|
name: "system:node-webhook"
|
2019-05-02 21:24:21 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2018-01-21 10:34:37 +00:00
|
|
|
resource: "clusterrole"
|
|
|
|
filename: "{{ kube_config_dir }}/node-webhook-cr.yml"
|
|
|
|
state: latest
|
|
|
|
when:
|
|
|
|
- rbac_enabled
|
|
|
|
- kubelet_authorization_mode_webhook
|
|
|
|
- node_webhook_cr_manifest.changed
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-01-21 10:34:37 +00:00
|
|
|
tags: node-webhook
|
|
|
|
|
|
|
|
- name: Kubernetes Apps | Add ClusterRoleBinding for system:nodes to webhook ClusterRole
|
|
|
|
template:
|
|
|
|
src: "node-webhook-crb.yml.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/node-webhook-crb.yml"
|
2021-07-12 07:00:47 +00:00
|
|
|
mode: 0640
|
2018-01-21 10:34:37 +00:00
|
|
|
register: node_webhook_crb_manifest
|
|
|
|
when:
|
|
|
|
- rbac_enabled
|
|
|
|
- kubelet_authorization_mode_webhook
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-01-21 10:34:37 +00:00
|
|
|
tags: node-webhook
|
|
|
|
|
|
|
|
- name: Grant system:nodes the webhook ClusterRole
|
|
|
|
kube:
|
|
|
|
name: "system:node-webhook"
|
2019-05-02 21:24:21 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2018-01-21 10:34:37 +00:00
|
|
|
resource: "clusterrolebinding"
|
|
|
|
filename: "{{ kube_config_dir }}/node-webhook-crb.yml"
|
|
|
|
state: latest
|
|
|
|
when:
|
|
|
|
- rbac_enabled
|
|
|
|
- kubelet_authorization_mode_webhook
|
|
|
|
- node_webhook_crb_manifest.changed
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-01-21 10:34:37 +00:00
|
|
|
tags: node-webhook
|
|
|
|
|
2018-07-20 14:56:38 +00:00
|
|
|
- include_tasks: oci.yml
|
|
|
|
tags: oci
|
|
|
|
when:
|
|
|
|
- cloud_provider is defined
|
|
|
|
- cloud_provider == 'oci'
|
2018-09-25 14:50:22 +00:00
|
|
|
|
|
|
|
- name: PriorityClass | Copy k8s-cluster-critical-pc.yml file
|
2021-07-12 07:00:47 +00:00
|
|
|
copy: src=k8s-cluster-critical-pc.yml dest={{ kube_config_dir }}/k8s-cluster-critical-pc.yml mode=0640
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane']|last
|
2018-09-25 14:50:22 +00:00
|
|
|
|
|
|
|
- name: PriorityClass | Create k8s-cluster-critical
|
|
|
|
kube:
|
|
|
|
name: k8s-cluster-critical
|
2019-05-02 21:24:21 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2018-09-25 14:50:22 +00:00
|
|
|
resource: "PriorityClass"
|
|
|
|
filename: "{{ kube_config_dir }}/k8s-cluster-critical-pc.yml"
|
|
|
|
state: latest
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane']|last
|