192.168.0.150 masterk8s192.168.0.151 node1k8s192.168.0.151 node2k8s
sudo apt-get update && sudo apt-get install && apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
Si deseas instalarlo en un Linux Arch, puedes seguir los pasos descritos en mi anterior post
Para funcionar de forma correcta con Kubeadm, es necesario modificar el daemon de Docker, para lo cual sigue el siguiente procedimiento:
cat <<EOF | sudo tee /etc/docker/daemon.json { "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2" } EOF
mkdir -p /etc/systemd/system/docker.service.d
Reinicia docker para aplicar cambios
systemctl daemon-reload && systemctl restart docker
sudo nano /etc/sysctl.d/k8s.confReinica y aplica los cambios sobre sysctl
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
sysctl --system
Agrega los repositorios necesarios para kubeadm
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.listInstala los paquetes de kubeadm
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
apiVersion: kubeadm.k8s.io/v1beta2kind: ClusterConfigurationkubernetesVersion: 1.20.1controlPlaneEndpoint: "masterk8s:6443"networking:podSubnet: 172.30.0.0/16
kubeadm init --config=config.yaml --upload-certs
para instalar versiones posteriores realiza la migracion de las configuraciones con kubeadm config migrate --old-config config.yaml --new-config new.yaml
root@kubernetes001:/home/testing# kubeadm init --config=new.yaml --upload-certs
[init] Using Kubernetes version: v1.25.4
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: E1202 03:01:05.511612 7395 remote_runtime.go:948] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
time="2022-12-02T03:01:05Z" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
Para resolver este error solo elimine el archivo de configuracion en todos los nodos del cluster y reinicie el servicio:
root@kubernetes001:/home/testing# rm /etc/containerd/config.toml
root@kubernetes001:/home/testing# systemctl restart containerd
Posterior a esto ejecute nuevamente el script de instalacion
root@kubernetes001:/home/testing# kubeadm init --config=new.yaml --upload-certs
mkdir -p $HOME/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown $(id -u):$(id -g) $HOME/.kube/configexport KUBECONFIG=/etc/kubernetes/admin.conf
kubeadm join masterk8s:6443 --token by80hn.dplbnomhkkkzqse4 \ --discovery-token-ca-cert-hash sha256:6014e89f272bea84ff2a04bd750785433cf6edfa62dbaf050cffaea847866878
root@master01:/home/testing/Kubernetes-files/Dashboard# crictl psWARN[0000] runtime connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead.WARN[0000] image connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock unix:///var/run/cri-dockerd.sock]. As the default settings are now deprecated, you should set the endpoint instead.E0131 21:47:33.674916 10631 remote_runtime.go:390] "ListContainers with filter from runtime service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory\"" filter="&ContainerFilter{Id:,State:&ContainerStateValue{State:CONTAINER_RUNNING,},PodSandboxId:,LabelSelector:map[string]string{},}"FATA[0000] listing containers: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/run/dockershim.sock: connect: no such file or directory"
0 Comments