calico con operator tigera

This commit is contained in:
trigkeyb
2025-01-12 10:52:09 +01:00
parent f6f9486efe
commit 4b7768a237
4 changed files with 50 additions and 6 deletions

View File

@@ -54,6 +54,7 @@ sudo apt install containerd.io -y
# sudo mkdir -p /etc/containerd # sudo mkdir -p /etc/containerd
sudo containerd config default|sudo tee /etc/containerd/config.toml >/dev/null 2>&1 sudo containerd config default|sudo tee /etc/containerd/config.toml >/dev/null 2>&1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml
sudo sed -i 's/pause:3.8/pause:3.10/g' /etc/containerd/config.toml
# restart containerd # restart containerd
sudo systemctl restart containerd sudo systemctl restart containerd
@@ -65,13 +66,13 @@ echo "Agregando el repositorio de Kubernetes..."
### sudo apt-get install apt-transport-https ca-certificates curl -y ### sudo apt-get install apt-transport-https ca-certificates curl -y
# If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below. # If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below.
# sudo mkdir -p -m 755 /etc/apt/keyrings # sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/k8s.gpg ##### curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/k8s.gpg
##### curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
#sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring #sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # allow unprivileged APT programs to read this keyring
# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list # This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list
echo 'deb [signed-by=/etc/apt/keyrings/k8s.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/k8s.list ##### echo 'deb [signed-by=/etc/apt/keyrings/k8s.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/k8s.list
##### echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.32/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
#sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # helps tools such as command-not-found to work correctly #sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # helps tools such as command-not-found to work correctly

View File

@@ -6,7 +6,7 @@ USER="curso" # Usuario con acceso sudo
echo "Inicializando el nodo maestro..." echo "Inicializando el nodo maestro..."
sudo kubeadm init --control-plane-endpoint=k8scp sudo kubeadm init --control-plane-endpoint=k8scp --upload-certs --pod-network-cidr=192.168.0.0/16
# sudo kubeadm init --pod-network-cidr=174.24.0.0/16 --cri-socket=unix:///run/containerd/containerd.sock --upload-certs --control-plane-endpoint=k8scp # sudo kubeadm init --pod-network-cidr=174.24.0.0/16 --cri-socket=unix:///run/containerd/containerd.sock --upload-certs --control-plane-endpoint=k8scp

View File

@@ -2,7 +2,35 @@
# Variables # Variables
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/calico.yaml curl -O https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml
curl -O https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml
kubectl create -f tigera-operator.yaml
kubectl create -f custom-resources.yaml
# kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/calico.yaml
wget https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/calico.yaml
sed -ie 's/192.168.0.0/172.24.0.0/g' calico.yaml

15
5.borra_cluster.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
# Variables
sudo kubeadm reset -f
sudo rm -rf /etc/cni/net.d
sudo ip link show | grep cni
sudo ip link delete <nombre-del-bridge>
sudo rm -rf /var/lib/kubelet /var/lib/dockershim /var/lib/etcd /var/lib/cni