-como saber si el OS tiene k8 instalado If using your own equipment you will have to disable swap on every node, and ensure there is only one network interface. Multiple interfaces are supported but require extra configuration. There may be other requirements which will be shown as warnings or errors when using the kubeadm command. Before install container runtime engine: crio, etc -----------------------------------------------------installing k8s 1.23 ---- version 1 repo manager ubuntu, kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl 1) Add a new repo for kubernetes root@cp:~# vim /etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main 1.1 Add a GPG key for the packages root@cp:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - root@cp:~# apt-get update Install the software root@cp:~# apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00 posibles errores: Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: kubeadm : Depends: kubernetes-cni (>= 0.8.7) kubelet : Depends: kubernetes-cni (>= 0.8.7) solutions root@node010:~# apt-cache search kubernetes-cni kubelet - Kubernetes Node Agent kubernetes-cni - Kubernetes CNI root@node010:~# apt-get install kubernetes-cni root@cp:~# apt-mark hold kubelet kubeadm kubectl root@node010:~# kubectl version root@node010:~# kubeadm version root@node010:~# kubelet --version NOTE: - Hasta aqui los mismo pasos para instalar k8s en control plane y workers. - Los sig pasos solo aplican para control planes 2)use Calico as a network plugin root@cp:~# wget https://docs.projectcalico.org/manifests/calico.yaml root@cp:~# less calico.yaml search name: CALICO_IPV4POOL_CIDR value:"192.168.0.0/16" 2.1 update hosts root@cp:~# vim /etc/hosts k8scp #<-- Add this line 3)Create a configuration file for the cluster. For crio kubeadm-crio.yaml. Inside tarball from linux fundation course wget https://training.linuxfoundation.org/cm/LFS258/LFS258_V2021-09-20_SOLUTIONS.tar.xz --user=LFtraining --password=Penguin2014 wget https://training.linuxfoundation.org/cm/LFS258/LFS258_V2022-03-22_SOLUTIONS.tar.xz --user=LFtraining --password=Penguin2014 Find th file and copy to home(del root) for crio use kubeadm-crio.yaml, update the following accordingly: ... apiVersion: kubeadm.k8s.io/v1beta2 kind: ClusterConfiguration kubernetesVersion: 1.23.1 #<-- Use the word stable for newest version controlPlaneEndpoint: "k8scp:6443" #<-- Use the node alias not the IP networking: podSubnet: 192.168.0.0/16 #<-- Match the IP range from the Calico config file 4)Initialize the control plane(cp) root@cp:# kubeadm init --config=kubeadm-crio.yaml --upload-certs | tee kubeadm-init.out # Save output for future review Success messages: Your Kubernetes control-plane has initialized successfully! To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config Alternatively, if you are the root user, you can run: export KUBECONFIG=/etc/kubernetes/admin.conf You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/ You can now join any number of the control-plane node running the following command on each as root: kubeadm join k8scp:6443 --token abcdef.0123456789abcdef \ --discovery-token-ca-cert-hash sha256:6cff953cb5b537a8eef9c32535dbe3db9deca2884f8000ac4e59c9c11854c85b \ --control-plane --certificate-key 733803415367b636ee688ae7b2cbda2b61f1d838366f148092efd8f329cec114 Please note that the certificate-key gives access to cluster sensitive data, keep it secret! As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use "kubeadm init phase upload-certs --upload-certs" to reload certs afterward. Then you can join any number of worker nodes by running the following on each as root: kubeadm join k8scp:6443 --token abcdef.0123456789abcdef \ --discovery-token-ca-cert-hash sha256:6cff953cb5b537a8eef9c32535dbe3db9deca2884f8000ac4e59c9c11854c85b 5) To start using your cluster, you need to run the following as a regular user: student@cp:~$ mkdir -p $HOME/.kube student@cp:~$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config student@cp:~$ sudo chown $(id -u):$(id -g) $HOME/.kube/config Alternatively, if you are the root user, you can run: export KUBECONFIG=/etc/kubernetes/admin.conf 6) Apply the network plugin configuration to your cluster. You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/ --para calico student@cp:$ kubectl apply -f calico.yaml 7)enable bash auto-completion student@cp:$ sudo apt-get install bash-completion -y student@cp:$ source <(kubectl completion bash) student@cp:$ echo "source <(kubectl completion bash)" >> $HOME/.bashrc