Compare commits
2 Commits
a1d9ea1a67
...
e509fd8225
| Author | SHA1 | Date | |
|---|---|---|---|
| e509fd8225 | |||
| 470fd15b56 |
@@ -1,4 +1,3 @@
|
||||
---
|
||||
- name: Initialise Kubernetes cluster
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
@@ -9,8 +8,35 @@
|
||||
- --upload-certs
|
||||
args:
|
||||
creates: /etc/kubernetes/admin.conf
|
||||
run_once: true
|
||||
|
||||
|
||||
- name: Generate Join Command
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- kubeadm
|
||||
- token
|
||||
- create
|
||||
- --print-join-command
|
||||
register: kubernetes_control_plane_join_command
|
||||
run_once: true
|
||||
changed_when: true
|
||||
|
||||
|
||||
- name: Get Certificate Key
|
||||
ansible.builtin.shell:
|
||||
cmd: set -o pipefail && kubeadm init phase upload-certs --upload-certs | tail -n 1
|
||||
register: kubernetes_control_plane_certificate_key
|
||||
run_once: true
|
||||
changed_when: true
|
||||
|
||||
|
||||
- name: Join Additional Control Planes
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ kubernetes_control_plane_join_command.stdout }} --control-plane --certificate-key {{ kubernetes_control_plane_certificate_key.stdout }}"
|
||||
args:
|
||||
creates: /etc/kubernetes/admin.conf
|
||||
|
||||
- name: Copy Kubernetes Admin Config
|
||||
ansible.builtin.command: "{{ item }}"
|
||||
loop:
|
||||
@@ -20,6 +46,12 @@
|
||||
args:
|
||||
creates: $HOME/.kube/config
|
||||
|
||||
- name: Install Kubernetes CLI
|
||||
ansible.builtin.apt:
|
||||
pkg:
|
||||
- kubectl
|
||||
state: present
|
||||
|
||||
# - name: Install Pod Network (Calico)
|
||||
# ansible.builtin.shell: kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.32.0/manifests/calico.yaml > pod_network_setup.txt
|
||||
# args:
|
||||
|
||||
+7
-7
@@ -4,14 +4,14 @@
|
||||
- common
|
||||
- kubernetes_common
|
||||
|
||||
# # ========================
|
||||
# # SETUP KUBERNETES CLUSTER
|
||||
# # ========================
|
||||
# ========================
|
||||
# Setup Kubernetes Cluster
|
||||
# ========================
|
||||
|
||||
# - name: Initialise Kubernetes cluster
|
||||
# hosts: masters[0]
|
||||
# roles:
|
||||
# - kubernetes_master
|
||||
- name: Initialise Kubernetes Cluster
|
||||
hosts: masters
|
||||
roles:
|
||||
- kubernetes_control_plane
|
||||
|
||||
# # =======================
|
||||
# # JOIN MASTERS TO CLUSTER
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ locals {
|
||||
ext_disk_size = "16GiB"
|
||||
network_cidr = "10.150.0.1/24"
|
||||
|
||||
master_count = 2
|
||||
master_count = 3
|
||||
worker_count = 0
|
||||
|
||||
image = "ubuntu/26.04"
|
||||
|
||||
Reference in New Issue
Block a user