-
Notifications
You must be signed in to change notification settings - Fork 3
/
kubeadm-init.yml
58 lines (52 loc) · 1.77 KB
/
kubeadm-init.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
- hosts: masters
become: yes
tasks:
- name: initialize the cluster
shell: kubeadm init --service-cidr 10.96.0.0/14 --pod-network-cidr 10.90.0.0/16 --kubernetes-version stable-1.22 --control-plane-endpoint kube-apiserver:6443 --cri-socket=/run/containerd/containerd.sock >> cluster_initialized.txt
args:
chdir: $HOME
creates: cluster_initialized.txt
- name: create .kube directory
become: yes
become_user: ubuntu
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/ubuntu/.kube/config
remote_src: yes
owner: ubuntu
- name: Create kube-router kube-config
become: yes
become_user: ubuntu
shell: kubectl create configmap kube-router-kubeconfig -n kube-system --from-file=.kube/config >> kuberouter-config-setup.txt
args:
chdir: $HOME
creates: kuberouter-config-setup.txt
- name: install Pod network
become: yes
become_user: ubuntu
shell: kubectl apply -f kube-router-v1.yaml >> pod_network_setup.txt
args:
chdir: $HOME
creates: pod_network_setup.txt
- name: Annotate Node
become: yes
become_user: ubuntu
shell:
cmd: |
kubectl annotate node $(uname -n) "kube-router.io/node.asn=64512" --overwrite
kubectl annotate node $(uname -n) "kube-router.io/peer.ips=172.20.22.253,172.20.22.254" --overwrite
kubectl annotate node $(uname -n) "kube-router.io/peer.asns=65000,65000" --overwrite
args:
chdir: $HOME
- name: add kube-apiserver service
become: yes
become_user: ubuntu
shell: kubectl apply -f kube-apiserver.yaml >> kube-apiserver.txt
args:
chdir: $HOME
creates: kube-apiserver.txt