Compare commits

...

6 Commits

Author SHA1 Message Date
trigkeyb
72d96550ce prueba completa 2025-01-12 12:29:40 +01:00
trigkeyb
a4577bb70b autocomplete 2025-01-12 12:18:23 +01:00
trigkeyb
6142bd0fad mas 2025-01-12 12:04:01 +01:00
trigkeyb
930f193a0c con IP 172 2025-01-12 12:01:12 +01:00
trigkeyb
87ad42c701 calico v3.29.1 2025-01-12 11:07:11 +01:00
trigkeyb
4b7768a237 calico con operator tigera 2025-01-12 10:52:09 +01:00
7 changed files with 69 additions and 20 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=172.24.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

@@ -1,25 +1,31 @@
#!/bin/bash #!/bin/bash
# Variables # instala con operator -ok-
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/calico.yaml curl -O https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/tigera-operator.yaml
# Instalar red de pods (Calico)
echo "Instalando la red de pods (Calico)..."
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/tigera-operator.yaml
curl -O https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/custom-resources.yaml curl -O https://raw.githubusercontent.com/projectcalico/calico/v3.29.1/manifests/custom-resources.yaml
sed -ie 's/192.168.0.0/172.24.0.0/g' custom-resources.yaml
sed -i 's/192.168.0.0/172.24.0.0/g' custom-resources.yaml
kubectl create -f tigera-operator.yaml
kubectl create -f custom-resources.yaml kubectl create -f custom-resources.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 get pods -A
### kubectl get pods -A -w
## instala con manifest -deprecated-
# 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
# kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml
## kubectl get pods --all-namespaces -w

View File

@@ -7,6 +7,19 @@ kubectl create deployment nginx-app --image nginx --replicas 2 --namespace demo-
kubectl get deployment -n demo-app kubectl get deployment -n demo-app
kubectl get pods -n demo-app kubectl get pods -n demo-app
kubectl expose deployment nginx-app -n demo-app --type NodePort --port 80
kubectl get svc -n demo-app
# poner la IP obtenida
#### curl http://<Any-worker-IP>:<puerto>
curl http://localhost:30336
kubectl run test-pod2 --image=busybox -- sleep 3600 kubectl run test-pod2 --image=busybox -- sleep 3600
kubectl create deployment gitea-app2 --image gitea/gitea:latest --replicas 2 --namespace demo-app kubectl create deployment gitea-app2 --image gitea/gitea:latest --replicas 2 --namespace demo-app

7
5.autocomplete_in_bash.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
echo 'source <(kubectl completion bash)' >>~/.bashrc
# Reload sourcefile again (located on home)
source .bashrc

15
6.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

View File

@@ -1,4 +1,11 @@
# infra_cloudinit # infra_cloudinit
https://pabpereza.notion.site/Install-kubernetes-1-28-on-Ubuntu-Server-20-04-LTS-6f8d28eadb6242f0a78c40eaa0211167
https://medium.com/@pabloperezaradros/install-kubernetes-1-28-e42ad9194d4f
https://www.linuxtechi.com/install-kubernetes-on-ubuntu-24-04/ https://www.linuxtechi.com/install-kubernetes-on-ubuntu-24-04/