-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2-master-config.yml
70 lines (65 loc) · 2.02 KB
/
2-master-config.yml
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
- hosts: master
become: true
tasks:
- name: Updates
apt:
update_cache: true
# kubectl not being found
- name: Install Kubectl
apt:
name: kubectl
state: present
force: yes
- name: Create an Empty file for Kubeadm configuring
copy:
content: ""
dest: /etc/kubernetes/kubeadm-config.yaml
force: false
- name: Configure container runtime
blockinfile:
path: /etc/kubernetes/kubeadm-config.yaml
block: |
kind: ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
networking:
podSubnet: "10.244.0.0/16"
---
kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
runtimeRequestTimeout: "15m"
cgroupDriver: "systemd"
systemReserved:
cpu: 100m
memory: 350M
kubeReserved:
cpu: 100m
memory: 50M
enforceNodeAllocatable:
- pods
- name: Initialize the cluster
shell: kubeadm init --config /etc/kubernetes/kubeadm-config.yaml >> cluster_initialized.log
args:
chdir: /home/vagrant # depends on env, validate this
creates: cluster_initialized.log
- name: Create .kube directory
become: true
become_user: vagrant # depends on env, validate this
file:
path: $HOME/.kube
state: directory
mode: "0755"
- name: Copy admin.conf to User's kube config
copy:
src: /etc/kubernetes/admin.conf
dest: /home/vagrant/.kube/config # depends on env, validate this
remote_src: true
owner: vagrant # depends on env, validate this
- name: Install Pod Network
become: true
become_user: vagrant # depends on env, validate this
shell: kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml >> pod_network_setup.log
args:
chdir: $HOME
creates: pod_network_setup.log
...