File tree Expand file tree Collapse file tree 5 files changed +38
-40
lines changed Expand file tree Collapse file tree 5 files changed +38
-40
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44# for more information.
55# This script will create a Kubernetes cluster using kubeadm.
66
7+ # IMPORTANT: THIS STEP IS REQUIRED FOR CNI SETUP VIA CALICO
8+
79# Look for a line starting with "default via"
10+ # For example: default via 10.128.0.1 dev ens5
811ip route show
912
13+ # Or get your network interface's ip address using the following command:
14+ export K8S_NET_IP=$( ip addr show dev $( ip route show | awk ' /^default/ {print $5}' ) | awk ' /inet / {print $2}' | cut -d/ -f1)
15+ echo " K8S_NET_IP=${K8S_NET_IP} "
16+
1017# On one of your nodes which to become a control node, execute following command:
11- sudo kubeadm init --cri-socket=unix:///var/run/crio/crio.sock
18+ sudo kubeadm init \
19+ --cri-socket=unix:///var/run/crio/crio.sock \
20+ --apiserver-advertise-address=${K8S_NET_IP} \
21+ --pod-network-cidr=192.168.0.0/16
1222
1323# The output will look like this:
1424# --------------------------------------------------------------------------------
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Refer to https://docs.tigera.io/calico/latest/getting-started/kubernetes/quickstart
4+ # for more information.
5+
6+ # Install the Tigera operator and custom resource definitions:
7+ kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.30.0/manifests/tigera-operator.yaml
8+
9+ # Install Calico by creating the necessary custom resources:
10+ kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.30.0/manifests/custom-resources.yaml
Original file line number Diff line number Diff line change @@ -22,26 +22,23 @@ echo "deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://download.o
2222sudo apt-get update
2323sudo apt-get install -y cri-o
2424
25+ # Update crio config by creating (or editing) /etc/crio/crio.conf
26+ sudo tee /etc/crio/crio.conf > /dev/null << EOF
27+ [crio.image]
28+ pause_image="registry.k8s.io/pause:3.10"
29+
30+ [crio.runtime]
31+ conmon_cgroup = "pod"
32+ cgroup_manager = "systemd"
33+ EOF
34+
2535# Start CRI-O
2636sudo systemctl start crio.service
2737
2838sudo swapoff -a
2939sudo modprobe br_netfilter
3040sudo sysctl -w net.ipv4.ip_forward=1
3141
32- # Update crio config by creating (or editing) /etc/crio/crio.conf
33- # sudo vi /etc/crio/crio.conf
34- # [crio.image]
35- # pause_image="registry.k8s.io/pause:3.10"
36- # [crio.runtime]
37- # conmon_cgroup = "pod"
38- # cgroup_manager = "systemd"
39-
40- # sysctl params required by setup, params persist across reboots
41- cat << EOF | sudo tee /etc/sysctl.d/k8s.conf
42- net.ipv4.ip_forward = 1
43- EOF
44-
4542# Apply sysctl params without reboot
4643sudo sysctl --system
4744
Original file line number Diff line number Diff line change 1717sudo kubeadm join < YOUR_CONTROL_PLANE_NODE_IP> --token < YOUR_GENERATED_TOKEN> \
1818 --discovery-token-ca-cert-hash sha256:< YOUR_GENERATED_CA_CERT_HASH> --cri-socket=unix:///var/run/crio/crio.sock
1919
20+ exit 0
21+
2022# If you lost above information, you can get the token and hash by running following command on your CONTROL PLANE node:
21- # To get <YOUR_CONTROL_PLANE_NODE_IP>
22- kubectl get nodes -o wide | grep -i control-plane | awk ' {printf $6}'
23+ # To get <YOUR_CONTROL_PLANE_NODE_IP>:
24+ export K8S_NET_IP=$( ip addr show dev $( ip route show | awk ' /^default/ {print $5}' ) | awk ' /inet / {print $2}' | cut -d/ -f1)
25+ echo " K8S_NET_IP=${K8S_NET_IP} "
2326
24- # To get <YOUR_GENERATED_TOKEN>
27+ # To get <YOUR_GENERATED_TOKEN>:
2528sudo kubeadm token create
2629
27- # To get <YOUR_GENERATED_CA_CERT_HASH>
30+ # To get <YOUR_GENERATED_CA_CERT_HASH>:
2831openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | \
2932openssl rsa -pubin -outform der 2> /dev/null | \
3033sha256sum | awk ' {print $1}'
You can’t perform that action at this time.
0 commit comments