This commit is contained in:
parent
7e5eb1911e
commit
58fae5e1bd
6 changed files with 96 additions and 16 deletions
|
|
@ -9,6 +9,12 @@
|
|||
fstype: swap
|
||||
state: absent
|
||||
|
||||
- name: Create a thin pool for kubernetes
|
||||
lvol:
|
||||
vg: vg_sys
|
||||
thinpool: kubernetes
|
||||
size: 20g
|
||||
|
||||
# Install API loadbalancer
|
||||
- include_tasks: "load_balancer.yml"
|
||||
when:
|
||||
|
|
@ -26,7 +32,7 @@
|
|||
- kubernetes_master|bool
|
||||
|
||||
- name: Configure audit policy
|
||||
file:
|
||||
copy:
|
||||
src: "etc/kubernetes/policies/audit-policy.yaml"
|
||||
dest: "/etc/kubernetes/policies/audit-policy.yaml"
|
||||
group: root
|
||||
|
|
@ -44,16 +50,6 @@
|
|||
when:
|
||||
- kubernetes_cri == "k3s"
|
||||
|
||||
- name: Check if a node is still tainted
|
||||
command: kubectl --kubeconfig=/etc/kubernetes/admin.conf get nodes '{{ ansible_hostname | lower }}' -o jsonpath='{.spec.taints}'
|
||||
when: kubernetes_master_taint
|
||||
register: current_taint
|
||||
|
||||
- name: taint the machine if needed
|
||||
# command: kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
|
||||
command: kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes '{{ ansible_hostname | lower }}' node-role.kubernetes.io/master-
|
||||
when: kubernetes_master_taint|bool and current_taint.stdout
|
||||
|
||||
#
|
||||
# At this point, we have a kubernetes up and running, but ready for it
|
||||
#
|
||||
|
|
@ -68,9 +64,9 @@
|
|||
when:
|
||||
- kubernetes_master|bool
|
||||
|
||||
- name: Copy certificat file on
|
||||
- name: Copy kubeconfig file from /etc/kubernetes/admin.conf
|
||||
copy:
|
||||
src: /etc/kubernetes/admin.conf
|
||||
src: "/etc/kubernetes/admin.conf"
|
||||
dest: /root/.kube/config
|
||||
remote_src: yes
|
||||
owner: root
|
||||
|
|
@ -78,6 +74,19 @@
|
|||
mode: 0600
|
||||
when:
|
||||
- kubernetes_master|bool
|
||||
- kubernetes_cri != "k3s"
|
||||
|
||||
- name: Copy kubeconfig file from /etc/rancher/k3s/k3s.yaml
|
||||
copy:
|
||||
src: "/etc/rancher/k3s/k3s.yaml"
|
||||
dest: /root/.kube/config
|
||||
remote_src: yes
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
when:
|
||||
- kubernetes_master|bool
|
||||
- kubernetes_cri == "k3s"
|
||||
|
||||
#
|
||||
# Manque autoconfig de .kube/config local
|
||||
|
|
@ -89,3 +98,14 @@
|
|||
# dest: /root/.kube/{{ kubernetes_cluster_name }}/ca.crt
|
||||
# when:
|
||||
# - kubernetes_master|bigip_pool
|
||||
|
||||
- name: Check if a node is still tainted
|
||||
command: kubectl get nodes '{{ ansible_hostname | lower }}' -o jsonpath='{.spec.taints}'
|
||||
when: kubernetes_master_taint
|
||||
register: current_taint
|
||||
|
||||
- name: taint the machine if needed
|
||||
# command: kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
|
||||
command: kubectl taint nodes '{{ ansible_hostname | lower }}' node-role.kubernetes.io/master-
|
||||
when: kubernetes_master_taint|bool and current_taint.stdout
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue