0% found this document useful (0 votes)
17 views15 pages

Mini Ku

Uploaded by

Puja Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views15 pages

Mini Ku

Uploaded by

Puja Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Updated 02/03/2020

MiniKube on Compute Engine

Sometimes as a developer we just need to have a place to call


our own for learning and/or development on a separate cluster
away from it all.
This remote isolated cluster allows us to get away from the
development and test environments effectively. To accomplish
this we may want to for example run MiniKube on GCP.
Minikube is a tool that makes it easy to run a single node
Kubernetes cluster locally on our desktop or in our cloud
environment.
Minikube effectively run by booting up a single-node
Kubernetes cluster inside a Virtual Machine (VM) on your
laptop or in this case Google Cloud Platform
Note that nested virtualization is required and must be enabled
when creating your VM. Nested Virtualization adds support for
Intel VT-x processor virtualization instructions to Compute
Engine VMs.
Using nested virtualization, you start a VM instance as normal
on Compute Engine and then install a KVM-compatible
hypervisor on the VM instance so you can run another VM
instance on top of that hypervisor.

Overview of process

To install MiniKube on GCP Compute Engine is a multifolded


effort. The tasks at a high level are as follows.

1. Determine a supported GCP region. Needs to support Intel


Haswell or newer.
2. Create Boot Disk to copy image
3. Enable Nested Virtualization
4. Select a supported VM image in Compute Engine.
5. Install MiniKube
6. Login and get to work

Process Workflow

Determine Zonal support for Intel Haswell


As expected to get started on GCP we must of course login and
ensure billing is enabled.

Note that you can create this deployment via the gcloud CLI or
the Cloud Console. We will use the CLI for this exercise.

1. Validate that the Haswell platform is supported in your


region by running

gcloud compute zones describe us-east1-b

Intel Haswell is there in the list so we may proceed with the


install in the specified region/zone US-East1-b

2. Create a boot disk which is really a staging disk.


The following should be simple enough
gcloud compute disks create stagingdisk --image-project
centos-cloud --image-family centos-7 --zone us-east1-b
3. Create a nested VM. Syntax is below.
gcloud compute images create nested-vm-image --source-
disk=disk1 --source-disk-zone=us-east1-b --
licenses=https://www.googleapis.com/compute/v1/projects/vm-
options/global/licenses/enable-vmx

4. Now we may want to delete the source disk we created


temporarily as a staging disk.
gcloud compute disks delete stagingdisk --zone us-east1-b
5. Create Image
gcloud compute instances create nested-vm-image1 --zone us-
east1-b --min-cpu-platform "Intel Haswell" --machine-type
n1-standard-4 --image nested-vm-image

We now need to verify the VM is available. You can view in


Cloud Console or SSH. If you did not login before then you
would want to view in Cloud Console and then Select an SSH
option.
6. Connect to VM, I am selecting Open in Browser window.

7. Verify the VM is online


grep -cw vmx /proc/cpuinfo
Install Kubectl

8. Install kubectl
sudo yum install -y kubectl

9. Make a directory
mkdir kubectl
10 . Change Permissions as needed.
chmod +x kubectl
11. Move to your /usr/bin directory
sudo mv ./kubectl /usr/local/bin/kubectl

Install Virtualbox

12. Install Virtualbox kernel

sudo yum install kernel-devel kernel-headers make patch gcc


wget

There are several screens to go thru. Note that on first screen


you need to select y to proceed.
12. Download Virtualbox
sudo wget
https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.r
epo -P /etc/yum.repos.d

13. Install Virtualbox


sudo yum install VirtualBox-6.0
Note that there are screens you will be prompted to enter Y.
Select Y

Select Y

Select Y
Continue on.

The install takes about 5 minutes with all the prompts.


Validate our Virtualbox is up and running.
systemctl status vboxdrv

Install MiniKube

14. Download and Install Minikube


curl -Lo minikube
https://storage.googleapis.com/minikube/releases/latest/minikub
e-linux-amd64 && chmod +x minikube

15. CP to directory.
sudo cp minikube /usr/bin/

16. Docker needs to be installed


sudo yum install docker

Here is another multistep part where you need to Select Y


Select Y
Start the MiniKube Cluster
17. Ensure you start with proper driver.
Change to the directory where mnikube binaries files are
located.

cd /usr/local/bin/
sudo -E ./minikube start --vm-driver=none

18. Start MiniKube


sudo -E ./minikube start --vm-driver=none

Check your cluster info.


gcloud container clusters list
kubectl cluster-info

You might also like