Compare commits
2 Commits
4abb4a929f
...
37da64cacf
Author | SHA1 | Date | |
---|---|---|---|
37da64cacf | |||
7662f4a11f |
@ -2,6 +2,6 @@
|
|||||||
- name: configure control plane
|
- name: configure control plane
|
||||||
hosts: k8s_control
|
hosts: k8s_control
|
||||||
gather_facts: true
|
gather_facts: true
|
||||||
become: false
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- k8s_control
|
- k8s_control
|
||||||
|
2
ansible/roles/k8s_control/defaults/main.yaml
Normal file
2
ansible/roles/k8s_control/defaults/main.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
k8s_control_master_node: kube01.balsillie.net
|
@ -1 +1,46 @@
|
|||||||
---
|
---
|
||||||
|
- name: create containerd config dir
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/containerd
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0664
|
||||||
|
|
||||||
|
- name: create containerd default config
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: |
|
||||||
|
containerd config default > /etc/containerd/config.toml
|
||||||
|
creates: /etc/containerd/config.toml
|
||||||
|
|
||||||
|
- name: enable systemd cgroups in containerd config
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/containerd/config.toml
|
||||||
|
regexp: '^(.*)SystemdCgroup = false$'
|
||||||
|
line: ' SystemdCgroup = true'
|
||||||
|
backrefs: true
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: enable and start containerd service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: containerd
|
||||||
|
state: restarted
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
- name: kubeadm init
|
||||||
|
when: ansible_host == {{ k8s_control_master_node }}
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: |
|
||||||
|
kubeadm init \
|
||||||
|
--apiserver-advertise-address="" \
|
||||||
|
--apiserver-cert-extra-sans="" \
|
||||||
|
--node-name k8s-master \
|
||||||
|
--pod-network-cidr=192.168.0.0/16
|
||||||
|
creates: /etc/kubernetes/admin.conf
|
||||||
|
|
||||||
|
- name: join remaining nodes
|
||||||
|
when: ansible_host != {{ k8s_control_master_node }}
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: |
|
||||||
|
|
||||||
|
creates:
|
||||||
|
Loading…
Reference in New Issue
Block a user