Prueba Kubernetes en menos de 10 minutos
Comments : 0

Crear primer cluster de kubernetes (k3s)
Cluster Hello World
Vamos a crear nuestro cluster utilizando k3d todo ejecutándose en contenedores
vagrant@ubuntu1804:~$ k3d cluster create helloworld --agents 1 --servers 1
INFO[0000] Created network 'k3d-helloworld'
INFO[0000] Created volume 'k3d-helloworld-images'
INFO[0001] Creating node 'k3d-helloworld-server-0'
INFO[0001] Creating node 'k3d-helloworld-agent-0'
INFO[0002] Creating node 'k3d-helloworld-agent-1'
INFO[0004] Creating LoadBalancer 'k3d-helloworld-serverlb'
INFO[0009] Cluster 'helloworld' created successfully!
INFO[0010] You can now use it like this:
kubectl cluster-info
En nuestro ejemplo:
masters | nodes |
---|---|
1 | 1 |
- –agents = # nodes
- –servers = # masters
Validando el Cluster
vagrant@ubuntu1804:~$ kubectl cluster-info
Kubernetes master is running at https://0.0.0.0:33187
CoreDNS is running at https://0.0.0.0:33187/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://0.0.0.0:33187/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Podemos listar los nodos que son parte de nuestro cluster
vagrant@ubuntu1804:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3d-helloworld-server-0 Ready master 107s v1.18.6+k3s1
k3d-helloworld-agent-0 Ready <none> 107s v1.18.6+k3s1
Podemos listar los pods que ya están en ejecución en nuestro cluster
vagrant@ubuntu1804:~$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system metrics-server-7566d596c8-rsb84 1/1 Running 0 3m2s
kube-system local-path-provisioner-6d59f47c7-gcbbn 1/1 Running 0 3m2s
kube-system coredns-8655855d6-bssm6 1/1 Running 0 3m2s
kube-system helm-install-traefik-f6f95 0/1 Completed 0 3m2s
kube-system svclb-traefik-x55fl 2/2 Running 0 98s
kube-system svclb-traefik-mcl8q 2/2 Running 0 98s
kube-system traefik-758cd5fc85-z2c8k 1/1 Running 0 98s
Eso es todo ya tenemos un cluster kubernetes para realizar nuestras pruebas de operaciones o desarrollo.
- Metrics Server
- Ingress (traefik)
- Local Storage
Puedes adaptar para crear un Cluster con más nodos y probar tus políticas de calendarización, toleration, taints, auto scalling, etc.
Algunos comandos útiles para k3d:
vagrant@ubuntu1804:~$ k3d cluster stop helloworld
vagrant@ubuntu1804:~$ k3d cluster start helloworld
vagrant@ubuntu1804:~$ k3d cluster delete helloworld