Install Minikube ubuntu 18.04
referencias: https://kubernetes.io/docs/setup/learning-environment/minikube/bext@bext-VPCF13WFX:~$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.2.0/minikube-linux-amd64 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 39.8M 100 39.8M 0 0 455k 0 0:01:29 0:01:29 --:--:-- 498k
bext@bext-VPCF13WFX:~$ chmod +x minikube bext@bext-VPCF13WFX:~$ sudo cp minikube /usr/local/bin [sudo] password for bext: bext@bext-VPCF13WFX:~$ rm minikube bext@bext-VPCF13WFX:~$Podemos eliminar el borrar minikube, pero tendremos que agregarlo al PATH.
1.- Arrancamos minikube y creamos un cluster
bext@bext-VPCF13WFX:~$ minikube start -p micluster 😄 minikube v1.2.0 on linux (amd64) 🔥 Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ... 🐳 Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6 💾 Downloading kubeadm v1.15.0 💾 Downloading kubelet v1.15.0 🚜 Pulling images ... 🚀 Launching Kubernetes ... ⌛ Verifying: apiserver proxy etcd scheduler controller dns 🏄 Done! kubectl is now configured to use "micluster" bext@bext-VPCF13WFX:~$
Se ha creado un minikube context llamado minikube. esto se hace automáticamente, manualmente se hace con
kubectl config use-context minikube
o se pasa como parametro
kubectl get pods --context=minikube
Podemos correr el dashboard especificamos el nombre del cluster ya que lo creamos con nombre micluster.
bext@bext-VPCF13WFX:~$ minikube dashboard -p micluster 🔌 Enabling dashboard ... 🤔 Verifying dashboard health ... 🚀 Launching proxy ... 🤔 Verifying proxy health ... 🎉 Opening http://127.0.0.1:38919/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/ in your default browser...
Probamos borrando el cluster
bext@bext-VPCF13WFX:~$ minikube delete 🙄 "minikube" cluster does not exist 🙄 "minikube" profile does not exist bext@bext-VPCF13WFX:~$ minikube delete -p micluster 🔥 Deleting "micluster" from virtualbox ... 💔 The "micluster" cluster has been deleted. bext@bext-VPCF13WFX:~$
Cremos de nuevo pero con nombre de cluster por default minikube
bext@bext-VPCF13WFX:~$ minikube start 😄 minikube v1.2.0 on linux (amd64) 🔥 Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ... 🐳 Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6 🚜 Pulling images ... 🚀 Launching Kubernetes ... ⌛ Verifying: apiserver proxy etcd scheduler controller dns 🏄 Done! kubectl is now configured to use "minikube"
minikube usa la imagen boot2docker con user y passwork:
user: docker
pass: tcuser
2.- Interactuamos con el cluster usando kubectl, usamos la imagen echoserver y la exponemos al puerto 8080
bext@bext-VPCF13WFX:~$ kubectl run prueba-minikube --image=k8s.gcr.io/echoserver:1.10 --port=8080 kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead. deployment.apps/prueba-minikube created
3.- Para acceder a prueba-minikube debemos exponerlo como servicio.
bext@bext-VPCF13WFX:~$ kubectl expose deployment prueba-minikube --type=NodePort service/prueba-minikube exposed
4.- Debemos esperar un poco a que se esponga el servicio
bext@bext-VPCF13WFX:~$ kubectl get pod NAME READY STATUS RESTARTS AGE prueba-minikube-69d8887f-fl5fm 1/1 Running 0 7m6s bext@bext-VPCF13WFX:~$
5.- obtenemos la url de donde se expuso el servicio prueba-minikube, y la accesamos.
bext@bext-VPCF13WFX:~$ minikube service prueba-minikube --url http://192.168.99.116:30950 bext@bext-VPCF13WFX:~$ curl http://192.168.99.116:30950 Hostname: prueba-minikube-69d8887f-fl5fm Pod Information: -no pod information available- Server values: server_version=nginx: 1.13.3 - lua: 10008 Request Information: client_address=172.17.0.1 method=GET real path=/ query= request_version=1.1 request_scheme=http request_uri=http://192.168.99.116:8080/ Request Headers: accept=*/* host=192.168.99.116:30950 user-agent=curl/7.58.0 Request Body: -no body in request- bext@bext-VPCF13WFX:~$
6.- Borramos el servicio prueba-minikube
bext@bext-VPCF13WFX:~$ kubectl delete services prueba-minikube service "prueba-minikube" deleted
7.- Borramos el deployment prueba-minikube
bext@bext-VPCF13WFX:~$ kubectl delete deployment prueba-minikube deployment.extensions "prueba-minikube" deleted
8.- Detemenos el cluster local minikube
bext@bext-VPCF13WFX:~$ minikube stop ✋ Stopping "minikube" in virtualbox ... 🛑 "minikube" stopped.
9.- Borramos el cluster local minikube
bext@bext-VPCF13WFX:~$ minikube delete 🔥 Deleting "minikube" from virtualbox ... 💔 The "minikube" cluster has been deleted.
eot
No hay comentarios:
Publicar un comentario