This setup is used to install prerequisites that are required to access/create/delete Google Kubernetes Engine.
- Prerequisites
- Install Vagrant Box
- Vagrant Box Details
- Create GKE cluster
- Access GKE cluster
- Delete GKE cluster
- Add-Ons provided
- Login Vagrant VM
- Stop Vagrant VM
- Restart Vagrant VM
- Destroy Vagrant VM
- Enable Virtualization(VT) in BIOS for Hyper-V
- Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository
- Vagrant (Version >= 2.2.0) is an open-source software product for building and maintaining portable virtual software development environments, e.g. for VirtualBox, Hyper-V, Docker containers, VMware, and AWS
- Oracle VM VirtualBox (Version >= 6.0) lets you run multiple operating systems on Mac OS, Windows, Linux, or Oracle Solaris.
- Minimum laptop/desktop configuration - 8GBRAM , 4CPU , support for VT-X
Default settings:env.yaml
. These settings can be changed as per your requirements and the below are minimum requirements.
VM:
ip: 100.10.10.116
cpus: 2
memory: 2048
vmname: gcloud-gke-ubuntu
hostname: gcloud-gke-ubuntu.com
Open windows (OR) bash
terminal from your local windows
machine
$ git clone https://github.com/SubhakarKotta/gcloud-gke-vagrant-ubuntu.git
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant up
Name | IP | OS | RAM | CPU |
---|---|---|---|---|
gcloud-gke-ubuntu | 100.10.10.116 | Ubuntu 18.04 | 2G | 2 |
Login to vagrant box from your local machine
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant ssh gcloud-gke-ubuntu
Provide GCLOUD Credentials
$ gcloud auth login
Create GKE Cluster by following the steps given in the link
$ kubectl get nodes
[To verify kubectl is connected to aks cluster]
Access Kubernetes Dashboard by following the steps given in the link
From local windows system terminal execute the below commands
$ ssh -L 8001:localhost:8001 vagrant@100.10.10.116
[password : vagrant]
Use the below command to generate access token to login Dashboard
$ kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode
Start proxy to access kubernetes dashboard
$ kubectl proxy
Login to vagrant box from your local machine
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant ssh gcloud-gke-ubuntu
Provide GCLOUD Credentials
$ gcloud auth login
Fetch/Update kubeconfig on your vagrant box
$ gcloud container clusters get-credentials <YOUR_CLUSTER_NAME> --zone <YOUR_ZONE_NAME> --project <YOUR_PROJECT_NAME>
$ kubectl get nodes
[To verify kubectl is connected to aks cluster]
Access Kubernetes Dashboard by following the steps given in the link
Login to vagrant box from your local machine
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant ssh gcloud-gke-ubuntu
Provide GCLOUD Credentials
$ gcloud auth login
Delete GKE Cluster by following the steps given in the link
kubectl
gcloud
helm
The Vagrant VM can be accessed in two ways from your local windows machine
vagrant ssh
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant ssh gcloud-gke-ubuntu
putty/mobaxterm
100.10.10.116
[vagrant/vagrant ]
Run the below command to stop the Vagrant Box from your local windows machine
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant halt
Run the below command to restart the Vagrant Box if the vagrant box is stopped from your local windows machine
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant up
Run the below command to delete the Vagrant Box from your local windows machine
$ cd gcloud-gke-vagrant-ubuntu/provisioning
$ vagrant destroy