Saturday, April 20, 2019

Using Multiple profiles with Minikube

0 lượt xem comment 0 comments

Kubernetes is the new Linux. K8s is the spec for the multi-poly cloud world. Running k8s could be very resource intensive, so is always a good idea being able to run things locally. For several reasons like Engineering Productivity, Tests and Experiments and so on and on. If you are working with Istio like I'm, you might realize it's a bit heavy to run local, especially if you do have other things running on k8s.  Minikube is the goto solution for local kubernetes clusters. However, as I said before, it can get pretty heavy when Istio gets involved. So the solution is pretty simple, it not much advertised. Minikube has a profile feature which allows you to create multiple profiles. Each profile will be a 2GB DISK VM created in Virtualbox. This is great because now you can run multiple kubernetes versions and multiple clusters doing multi experiments. IMHO is always great to have a k8s cluster ready to test things so I have multiple profiles like istio, lightweight, tests, etc... The first time you create the profile takes some time, up to 10min worst case but after the profile created things are super fast.

Running Multiple profiles with Minikube

Minikube has powerful feature called profiles, this feature allow we create different virtual machine based on a name, each profile cost avg ~2GB disk space. I found this super useful since have istio(heavy weight) proile and I need todo some quick local tests and want fast bootup and less resource consuption.

Profile 1

minikube profile test
minikube start -p test
😄  minikube v1.0.0 on linux (amd64)
🤹  Downloading Kubernetes v1.14.0 images in the background ...
🔥  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
💿  Downloading Minikube ISO ...
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
2019/04/10 11:51:51 No matching credentials were found, falling back on anonymous
 142.88 MB / 142.88 MB [============================================] 100.00% 0s
📶  "test" IP address is 192.168.99.100
🐳  Configuring Docker as the container runtime ...
🐳  Version of container runtime is 18.06.2-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
💾  Downloading kubeadm v1.14.0
💾  Downloading kubelet v1.14.0
🚜  Pulling images required by Kubernetes v1.14.0 ...
🚀  Launching Kubernetes v1.14.0 using kubeadm ... 
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑  Configuring cluster permissions ...
🤔  Verifying component health .....
💗  kubectl is now configured to use "test"
🏄  Done! Thank you for using minikube!
alias k=kubectl
k get svc 
k get nodes
minikube stop
k get svc
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   26m

k get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   26m   v1.14.0

✋  Stopping "deploy" in virtualbox ...
🛑  "deploy" stopped.

Profile 2

minikube profile deploy
minikube start -p deploy
😄  minikube v1.0.0 on linux (amd64)
🤹  Downloading Kubernetes v1.14.0 images in the background ...
🔥  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶  "deploy" IP address is 192.168.99.100
🐳  Configuring Docker as the container runtime ...
🐳  Version of container runtime is 18.06.2-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
🚜  Pulling images required by Kubernetes v1.14.0 ...
🚀  Launching Kubernetes v1.14.0 using kubeadm ... 
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑  Configuring cluster permissions ...
🤔  Verifying component health .....
💗  kubectl is now configured to use "deploy"
🏄  Done! Thank you for using minikube!
alias k=kubectl
k get svc 
k get nodes
minikube stop
k get svc
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   26m

k get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   26m   v1.14.0

✋  Stopping "deploy" in virtualbox ...
🛑  "deploy" stopped.


Cheers,
Diego Pacheco
Tags: no keyword

comment 0 comments

Chuyên mục văn hoá giải trí của VnExpress

.

© 2017 www.blogthuthuatwin10.com

Tầng 5, Tòa nhà FPT Cầu Giấy, phố Duy Tân, Phường Dịch Vọng Hậu, Quận Cầu Giấy, Hà Nội
Email: nguyenanhtuan2401@gmail.com
Điện thoại: 0908 562 750 ext 4548; Liên hệ quảng cáo: 4567.