-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
501 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: Binary Install | ||
hosts: | ||
- k8s_cluster | ||
- nfs | ||
- image_registry | ||
gather_facts: true | ||
tasks: | ||
- name: NFS Install | ||
hosts: | ||
- nfs | ||
roles: | ||
- install/nfs | ||
|
||
- name: Image Registry Install | ||
hosts: | ||
- image_registry | ||
roles: | ||
- install/image-registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
- name: BootStrap Ready | ||
hosts: | ||
- kube_control_plane | ||
- kube_worker | ||
tasks: | ||
- name: Kubernetes Install | ||
hosts: | ||
- k8s_cluster | ||
vars_files: | ||
- vars/registry_configuration.yaml | ||
gather_facts: true | ||
roles: | ||
- install/cri | ||
- install/kubernetes | ||
|
||
- name: Certs Distribution | ||
hosts: | ||
- kube_control_plane | ||
roles: | ||
- role: install/certs | ||
when: .renew_certs.enabled | ||
|
||
- name: Install CNI | ||
hosts: | ||
- kube_control_plane|random | ||
roles: | ||
- addons/cni | ||
- addons/kata | ||
- addons/nfd | ||
- addons/sc | ||
|
||
- import_playbook: hook/post_install.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: Check Connect | ||
hosts: all | ||
ignore_errors: true | ||
tasks: | ||
- name: Check Connect for Hosts | ||
when: .inventory_name | ne "localhost" | ||
command: echo 1 | ||
# post_tasks: | ||
# - name: Compute Respond Time for Hosts | ||
# command: ping -c 1 -W 1 k8s-master-node | grep time= | awk '{print $8}' | cut -d'=' -f2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
- name: Uninstall Kubernetes Cluster | ||
hosts: all | ||
become: yes | ||
gather_facts: no | ||
tasks: | ||
- name: Check if node is a control plane | ||
stat: | ||
path: /etc/kubernetes/manifests/kube-apiserver.yaml | ||
register: is_control_plane | ||
|
||
- name: Stop and disable kubelet service | ||
systemd: | ||
name: kubelet | ||
state: stopped | ||
enabled: no | ||
|
||
- name: Reset kubeadm (if installed) | ||
shell: kubeadm reset -f | ||
ignore_errors: true | ||
|
||
- name: Remove Kubernetes directories | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
with_items: | ||
- /etc/kubernetes/ | ||
- /var/lib/kubelet/ | ||
- /var/lib/etcd/ | ||
- /etc/cni/net.d/ | ||
- /var/lib/cni/ | ||
|
||
- name: Flush iptables rules | ||
command: iptables -F | ||
|
||
- name: Delete iptables chains | ||
command: iptables -X | ||
|
||
- name: Flush iptables NAT table | ||
command: iptables -t nat -F | ||
|
||
- name: Delete iptables NAT table chains | ||
command: iptables -t nat -X | ||
|
||
- name: Flush iptables mangle table | ||
command: iptables -t mangle -F | ||
|
||
- name: Delete iptables mangle table chains | ||
command: iptables -t mangle -X | ||
|
||
- name: Flush iptables raw table | ||
command: iptables -t raw -F | ||
|
||
- name: Delete iptables raw table chains | ||
command: iptables -t raw -X | ||
|
||
- name: Clear IPVS rules | ||
command: ipvsadm -C | ||
ignore_errors: true | ||
|
||
- name: Set ip_forward to 1 | ||
sysctl: | ||
name: net.ipv4.ip_forward | ||
value: 1 | ||
state: present | ||
|
||
- name: Enable bridge-nf-call-iptables | ||
sysctl: | ||
name: net.bridge.bridge-nf-call-iptables | ||
value: 1 | ||
state: present | ||
|
||
- name: Enable bridge-nf-call-ip6tables | ||
sysctl: | ||
name: net.bridge.bridge-nf-call-ip6tables | ||
value: 1 | ||
state: present | ||
|
||
- name: Remove CNI plugins | ||
file: | ||
path: /opt/cni/bin | ||
state: absent | ||
|
||
- name: Purge Kubernetes packages | ||
apt: | ||
name: "{{ item }}" | ||
state: absent | ||
purge: yes | ||
with_items: | ||
- kubelet | ||
- kubectl | ||
- kubeadm | ||
|
||
- name: Autoremove unused packages | ||
apt: | ||
name: "*" | ||
state: latest | ||
autoremove: yes | ||
|
||
- name: Autoclean package cache | ||
apt: | ||
autoclean: yes | ||
|
||
- name: Remove etcd data (for control plane nodes only) | ||
file: | ||
path: /var/lib/etcd | ||
state: absent | ||
when: is_control_plane.stat.exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- name: ETCD Binary Install | ||
hosts: | ||
- etcd | ||
gather_facts: true | ||
var_files: | ||
- vars/cluster_requirements.yaml | ||
tasks: | ||
- name: Stop if arch supported | ||
assert: | ||
that: or (.cluster_require.supported_architectures.amd64 | has .os.architecture) (.cluster_require.supported_architectures.arm64 | has .os.architecture) | ||
success_msg: | | ||
{{- if .cluster_require.supported_architectures.amd64 | has .os.architecture }} | ||
amd64 | ||
{{- else }} | ||
arm64 | ||
{{- end }} | ||
fail_msg: "{{ .os.architecture }} is not a known arch" | ||
register: binary_type | ||
|
||
- name: ETCD Binary Install | ||
gather_facts: true | ||
roles: | ||
- install/etcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
- import_playbook: hook/pre_install.yaml | ||
|
||
- name: Environment PreCheck | ||
gather_facts: true | ||
hosts: | ||
- k8s_cluster | ||
- etcd | ||
- image_registry | ||
- nfs | ||
tags: [ "always" ] | ||
roles: | ||
- precheck/env_check | ||
|
||
- name: Initialize OS | ||
gather_facts: true | ||
hosts: | ||
- k8s_cluster | ||
- etcd | ||
- image_registry | ||
roles: | ||
- init/init-os | ||
|
||
- name: Download Artifacts | ||
hosts: | ||
- localhost | ||
roles: | ||
- init/init-artifact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cluster_require: | ||
supported_architectures: | ||
amd64: | ||
- amd64 | ||
- x86_64 | ||
arm64: | ||
- arm64 | ||
- aarch64 |
Oops, something went wrong.