Jarno Rankinen revised this gist . Go to revision
1 file changed, 2 insertions
kubeadm-init.sh
@@ -33,6 +33,8 @@ kubeadm init --apiserver-advertise-address=10.75.254.1 --pod-network-cidr=10.244 | |||
33 | 33 | kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml | |
34 | 34 | kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.4/config/manifests/metallb-native.yaml | |
35 | 35 | ||
36 | + | kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)" | |
37 | + | ||
36 | 38 | # change address pool below | |
37 | 39 | cat <<EOF>metallb-addresspool.yaml | |
38 | 40 | apiVersion: metallb.io/v1beta1 |
Jarno Rankinen revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
kubeadm-init.sh
@@ -31,7 +31,7 @@ kubeadm init --apiserver-advertise-address=10.75.254.1 --pod-network-cidr=10.244 | |||
31 | 31 | # Take note of the join command | |
32 | 32 | ||
33 | 33 | kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml | |
34 | - | kubectl apply -f https://raw.githubusercontent.com/metallb/v0.13.4/config/manifests/metallb-native.yaml | |
34 | + | kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.4/config/manifests/metallb-native.yaml | |
35 | 35 | ||
36 | 36 | # change address pool below | |
37 | 37 | cat <<EOF>metallb-addresspool.yaml |
Jarno Rankinen revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
kubeadm-init.sh
@@ -30,7 +30,7 @@ kubeadm init --apiserver-advertise-address=10.75.254.1 --pod-network-cidr=10.244 | |||
30 | 30 | ||
31 | 31 | # Take note of the join command | |
32 | 32 | ||
33 | - | kubectl apply -fw.ragithubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml | |
33 | + | kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml | |
34 | 34 | kubectl apply -f https://raw.githubusercontent.com/metallb/v0.13.4/config/manifests/metallb-native.yaml | |
35 | 35 | ||
36 | 36 | # change address pool below |
Jarno Rankinen revised this gist . Go to revision
1 file changed, 54 insertions
kubeadm-init.sh(file created)
@@ -0,0 +1,54 @@ | |||
1 | + | swapoff /dev/xxx | |
2 | + | # disable in /etc/fstab also | |
3 | + | systemctl mask --now firewalld | |
4 | + | echo br_netfilter >> /etc/modules-load.d/kubernetes.conf | |
5 | + | modprobe br_netfilter | |
6 | + | sysctl -w net.ipv4.ip_forwarding=1 | tee -a /etc/sysctl.conf | |
7 | + | sysctl -w net.bridge.bridge-nf-call-iptables=1 | tee -a /etc/sysctl.conf | |
8 | + | sysctl -w net.bridge.bridge-nf-call-ip6tables=1 | tee -a /etc/sysctl.conf | |
9 | + | ||
10 | + | cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo | |
11 | + | [kubernetes] | |
12 | + | name=Kubernetes | |
13 | + | baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch | |
14 | + | enabled=1 | |
15 | + | gpgcheck=1 | |
16 | + | gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg | |
17 | + | exclude=kubelet kubeadm kubectl | |
18 | + | EOF | |
19 | + | ||
20 | + | export OS=CentOS_8 | |
21 | + | export VERSION=1.24 | |
22 | + | curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/devel:kubic:libcontainers:stable.repo | |
23 | + | curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo | |
24 | + | dnf makecache | |
25 | + | dnf install -y kubelet-1.24.0 kubeadm-1.24.0 kubectl-1.24.0 crio | |
26 | + | sudo setenforce 0 | |
27 | + | sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config | |
28 | + | sudo systemctl enable --now kubelet crio | |
29 | + | kubeadm init --apiserver-advertise-address=10.75.254.1 --pod-network-cidr=10.244.0.0/16 | |
30 | + | ||
31 | + | # Take note of the join command | |
32 | + | ||
33 | + | kubectl apply -fw.ragithubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml | |
34 | + | kubectl apply -f https://raw.githubusercontent.com/metallb/v0.13.4/config/manifests/metallb-native.yaml | |
35 | + | ||
36 | + | # change address pool below | |
37 | + | cat <<EOF>metallb-addresspool.yaml | |
38 | + | apiVersion: metallb.io/v1beta1 | |
39 | + | kind: IPAddressPool | |
40 | + | metadata: | |
41 | + | name: first-pool | |
42 | + | namespace: metallb-system | |
43 | + | spec: | |
44 | + | addresses: | |
45 | + | - 192.168.1.101-192.168.1.199 | |
46 | + | --- | |
47 | + | apiVersion: metallb.io/v1beta1 | |
48 | + | kind: L2Advertisement | |
49 | + | metadata: | |
50 | + | name: example | |
51 | + | namespace: metallb-system | |
52 | + | EOF | |
53 | + | ||
54 | + | kubectl apply -f metallb-addresspool.yaml |