-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-CreateMaster.sh
63 lines (45 loc) · 2.35 KB
/
1-CreateMaster.sh
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
#Only on the master, download the yaml files for the pod network
wget https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
#wget https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml
wget https://docs.projectcalico.org/v3.10/manifests/calico.yaml
#Look inside calico.yaml and find the network range, adjust if needed.
vi calico.yaml
#Create our kubernetes cluster, specifying a pod network range matching that in calico.yaml!
sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=<Ip address of master>
#Configure our account on the master to have admin access to the API server from a non-privileged account.
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
# Sometime the liveness and readiness probes of calico fails. In that case
# remove the readiness and liveness probes from calico.yaml
# Also if the network interface card is different than the default, the network
# wont come up. In that case you need to change the setting in calico.yaml
# Add the the below two lines
- name: IP_AUTODETECTION_METHOD
value: "interface=eth.*"
# after the section
# Auto-detect the BGP IP address.
- name: IP
value: "autodetect"
#Download yaml files for your pod network
kubectl apply -f rbac-kdd.yaml
kubectl apply -f calico.yaml
#Look for the all the system pods and calico pod to change to Running.
#The DNS pod won't start until the Pod network is deployed and Running.
kubectl get pods --all-namespaces
#Gives you output over time, rather than repainting the screen on each iteration.
kubectl get pods --all-namespaces --watch
#All system pods should be Running
kubectl get pods --all-namespaces
#Get a list of our current nodes, just the master.
kubectl get nodes
#Check out the systemd unit, and examine 10-kubeadm.conf
#Remeber the kubelet starts static pod manifests, and thus the core cluster pods
sudo systemctl status kubelet.service
#check out the directory where the kubeconfig files live
ls /etc/kubernetes
#let's check out the manifests on the master
ls /etc/kubernetes/manifests
#And look more closely at API server and etcd's manifest.
sudo more /etc/kubernetes/manifests/etcd.yaml
sudo more /etc/kubernetes/manifests/kube-apiserver.yaml