Readme k3s - #2
Open
Lu1s4lb3rtO wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rancher's k3s - Primeros pasos
Distribución de Kubernetes liviana, fácil y rápida con una huella muy pequeña
https://k3s.io o https://k3d.io para la versión dockerizada de k3s.
Step 1: Update Ubuntu system ( server y worker)
With your servers installed with Ubuntu 20.04, update and upgrade them:
sudo apt update
sudo apt -y upgrade && sudo systemctl reboot
.
sudo ufw allow 6443/tcp
sudo ufw allow 443/tcp
Add your user to Docker group to avoid typing sudo everytime you run docker commands.
sudo usermod -aG docker ${USER}
newgrp docker
Instalar maestro
curl -sfL https://get.k3s.io | sh -s - --disable traefik --write-kubeconfig-mode 644 --node-name k3s-master-01Instalar Worker
Tome el token del nodo maestro para poder agregarle nodos trabajados:
cat /var/lib/rancher/k3s/server/node-tokenInstale k3s en el nodo trabajador y agréguelo a nuestro clúster:
curl -sfL https://get.k3s.io | K3S_NODE_NAME=k3s-worker-01 K3S_URL=https://<IP>:6443 K3S_TOKEN=<TOKEN> sh -curl -sfL https://get.k3s.io | K3S_NODE_NAME=k3s-worker-01 K3S_URL=https://10.128.0.9:6443 K3S_TOKEN=K1097cbffbb0f65d3a8c645a73bfc7570ec7a4f9c38eb14fedba3685a11469fd0fe::server:4bc573eb869c0da574284f8ce13399d2 sh -
el del master
curl -sfL https://get.k3s.io | K3S_NODE_NAME=k3s-worker-01 K3S_URL=https://10.128.0.4:6443 K3S_TOKEN=K10ce2b02969fbb57f1d5b5907a3c716560b2783d918078ddcde86dda4264f73e92::server:360517b6eb2f7c876834318a565800e9 sh -
##You can verify if the k3s-agent on the worker nodes is running by:
sudo systemctl status k3s-agent
validar la conexión
kubectl get nodes
Instalar el controlador de entrada nginx
Sitio web: https://kubernetes.github.io/ingress-nginx/
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.1/deploy/static/provider/cloud/deploy.yamlNota importante para AWS, Azure, GCP
No puedo explicarlo en detalle, pero si ejecuta una máquina virtual en AWS, Azure o GCP, el "ingreso-nginx" solo seleccionará la IP privada como IP externa. Debe editar manualmente el servicio para que su dirección IP pública esté disponible para nginx, de modo que pueda comenzar a escuchar en su dirección IP pública.
kubectl -n ingress-nginx edit svc ingress-nginx-controllerAgregue su IP como lista para que
spec.externalIPsle guste:validar la conexión
kubectl get ing
Información adicional
Puede cambiar la configuración de k3s cambiando la configuración del servicio, por ejemplo, con
nano /etc/systemd/system/k3s.service.Asegúrese de reiniciar el servicio después:
systemctl restart k3sEn muchos casos, puede volver a ejecutar el instalador con diferentes variables y configurará su clúster en consecuencia sin eliminarlo en primer lugar.
Implementar aplicación de demostración
kubectl apply -f manifest.yamlRancher's k3s - Primeros pasosDistribución de Kubernetes liviana, fácil y rápida con una huella muy pequeña
https://k3s.io/ o https://k3d.io/ para la versión dockerizada de k3s.
Manifestación
Usaré Linode para esa demostración.
Instalar maestro
curl -sfL https://get.k3s.io | sh -s - --disable traefik --write-kubeconfig-mode 644 --node-name k3s-master-01
Instalar trabajador
Tome el token del nodo maestro para poder agregarle nodos trabajados:
cat /var/lib/rancher/k3s/server/node-token
K10ce2b02969fbb57f1d5b5907a3c716560b2783d918078ddcde86dda4264f73e92::server:360517b6eb2f7c876834318a565800e9
Instale k3s en el nodo trabajador y agréguelo a nuestro clúster:
curl -sfL https://get.k3s.io | K3S_NODE_NAME=k3s-worker-01 K3S_URL=https://:6443 K3S_TOKEN= sh -
Instalar el controlador de entrada nginx
Sitio web: https://kubernetes.github.io/ingress-nginx/
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.1/deploy/static/provider/cloud/deploy.yaml
validar conexion
kubectl -n ingress-nginx get po
kubectl -n ingress-nginx get svc
Nota importante para AWS, Azure, GCP
No puedo explicarlo en detalle, pero si ejecuta una máquina virtual en AWS, Azure o GCP, el "ingreso-nginx" solo seleccionará la IP privada como IP externa. Debe editar manualmente el servicio para que su dirección IP pública esté disponible para nginx, de modo que pueda comenzar a escuchar en su dirección IP pública.
kubectl -n ingress-nginx edit svc ingress-nginx-controller
Agregue su IP como lista para que spec.externalIPsle guste:
spec:
externalIPs:
- <YOUR_IP>
Información adicional
Puede cambiar la configuración de k3s cambiando la configuración del servicio, por ejemplo, con nano /etc/systemd/system/k3s.service.
Asegúrese de reiniciar el servicio después:systemctl restart k3s
En muchos casos, puede volver a ejecutar el instalador con diferentes variables y configurará su clúster en consecuencia sin eliminarlo en primer lugar.
Implementar aplicación de demostración
kubectl apply -f manifest.yaml