-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.yml
More file actions
39 lines (35 loc) · 1.02 KB
/
Copy pathinit.yml
File metadata and controls
39 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: Initialize the kubeadm cluster
ansible.builtin.shell: >
kubeadm init
--apiserver-advertise-address={{ ansible_default_ipv4.address }}
--apiserver-cert-extra-sans={{ ansible_host }}
--pod-network-cidr=10.244.0.0/16
--cri-socket=unix:///var/run/containerd/containerd.sock
args:
creates: /etc/kubernetes/admin.conf
- name: Wait for etcd to be ready
ansible.builtin.wait_for:
host: "{{ ansible_default_ipv4.address }}"
port: 2379
delay: 10
timeout: 120
- name: Wait for the API server to be ready
ansible.builtin.wait_for:
host: "{{ ansible_default_ipv4.address }}"
port: 6443
delay: 30
timeout: 180
- name: Create the .kube directory
ansible.builtin.file:
path: /home/{{ kubeadm_user }}/.kube
state: directory
owner: "{{ kubeadm_user }}"
mode: "0755"
- name: Copy kubeconfig
ansible.builtin.copy:
src: /etc/kubernetes/admin.conf
dest: /home/{{ kubeadm_user }}/.kube/config
owner: "{{ kubeadm_user }}"
mode: "0600"
remote_src: true