Install Docker
sudo apt update
sudo apt install docker.io
sudo systemctl enable docker
sudo systemctl start docker
Install Kubernetes
apt install apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
sudo apt install kubeadm kubelet kubectl kubernetes-cni
Disable swap & add kernel settings
sudo swapoff -a
sudo sed -i '/swap/ s/^\(.*\)$/#\1/g' /etc/fstab
sudo tee /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
sudo tee /etc/sysctl.d/kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
Containerd Run time
sudo apt install -y curl gnupg2 software-properties-common apt-transport-https ca-certificates
#sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y containerd.io
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 systemctl enable containerd
sudo systemctl restart containerd
Set hostnames
sudo hostnamectl set-hostname dmaster
sudo hostnamectl set-hostname dnodo1
sudo hostnamectl set-hostname dnodo2
/etc/hosts
192.168.253.100 dmaster.opensur.com.ar dmaster
192.168.253.101 dnodo1.opensur.com.ar dnodo1
192.168.253.102 dnodo2.opensur.com.ar dnodo2
Initialize Kubernetes master server
sudo kubeadm init --v=5
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
kubectl get pods --all-namespaces
Join the Kubernetes cluster
ojo es el que da cuando terminamos la inicializacion.
kubeadm join 192.168.253.100:6443 --token lryrw3.9ur4ff4vky2y19cf --discovery-token-ca-cert-hash sha256:51fcc2312ff5f9862958e143652dc54c73db6308a787baad062b8188360af158
kubectl get nodes
Deploying a service on Kubernetes cluster
kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
kubectl run --image=nginx nginx-server --port=80 --env="DOMAIN=cluster"
kubectl expose deployment nginx-deployment --port=80 --name=nginx-http
sudo docker ps
kubectl get svc
Install Calico Pod Network Add-on
curl https://projectcalico.docs.tigera.io/manifests/calico.yaml -O
kubectl apply -f calico.yaml
kubectl get pods -n kube-system
Deploy Kubernet Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
kubectl -n kubernetes-dashboard create token admin-user
kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8080:443 --address 0.0.0.0 &
kubectl create serviceaccount dashboard-admin-sa
kubectl create clusterrolebinding dashboard-admin-sa --clusterrole=cluster-admin --serviceaccount=default:dashboard-admin-sa
kubectl create serviceaccount nginx-proxy -n kube-system
Fijar el token
kubectl get secret admin-user-token-llmbj -o jsonpath="{.data.token}"
kubectl get secret -o jsonpath="{.data.token}" (Este me funciono)
Translate
lunes, 23 de octubre de 2023
Install K8s Cluster Ubuntu 20.04
Suscribirse a:
Entradas (Atom)