forked from cmd-ntrf/kubeadm-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit-master.bash
executable file
·33 lines (27 loc) · 1.52 KB
/
init-master.bash
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
#!/bin/bash
set -e
# By now the master node should be ready!
# Initialize kubeadm
sysctl net.bridge.bridge-nf-call-iptables=1
#kubeadm init --pod-network-cidr=10.244.0.0/16
kubeadm init --config kube-config.yaml
# To use the cluster
mkdir -p $HOME/.kube
cp --remove-destination /etc/kubernetes/admin.conf $HOME/.kube/config
chown ${SUDO_UID} $HOME/.kube/config
# Install flannel
#kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
#kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.13.0/Documentation/kube-flannel.yml
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.20.0/Documentation/kube-flannel.yml
# Make master node a running worker node too!
# FIXME: Use taint tolerations instead in the future
kubectl taint nodes --all node-role.kubernetes.io/master-
# Install and initialize helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# Tiller is removed with helm3
#kubectl --namespace kube-system create serviceaccount tiller
#kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
#helm init --service-account tiller --wait
#kubectl patch deployment tiller-deploy --namespace=kube-system --type=json --patch='[{"op": "add", "path": "/spec/template/spec/containers/0/command", "value": ["/tiller", "--listen=localhost:44134"]}]'
# Wait for tiller to be ready!
#kubectl rollout status --namespace=kube-system deployment/tiller-deploy --watch