prueba 002

This commit is contained in:
trigkeyb
2025-01-09 21:01:53 +01:00
parent dbe9ea3dd2
commit d8e64abba2
2 changed files with 64 additions and 8 deletions

View File

@@ -1,14 +1,13 @@
#!/bin/bash
# Variables
KUBERNETES_VERSION="1.28.2-00" # Cambia por la versión que necesites
USER="curso" # Usuario con acceso sudo
# Inicializar el nodo maestro (opcional)
read -p "¿Quieres inicializar el nodo maestro ahora? (y/n): " INIT_MASTER
if [ "$INIT_MASTER" == "y" ]; then
echo "Inicializando el nodo maestro..."
sudo kubeadm init --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
# Configurar kubectl para el usuario
echo "Configurando kubectl para el usuario $USER..."
@@ -18,7 +17,20 @@ if [ "$INIT_MASTER" == "y" ]; then
# Instalar red de pods (Calico)
echo "Instalando la red de pods (Calico)..."
kubectl apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml
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
sed -ie 's/192.168.0.0/172.24.0.0/g' 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 apply -f https://docs.projectcalico.org/v3.25/manifests/calico.yaml
## kubectl get pods --all-namespaces -w
else
echo "Nodo maestro no inicializado. Ejecuta 'kubeadm init' manualmente si deseas configurarlo más tarde."
fi