gcloud - Google Cloud command line Interface - Part -1


gcloud is a command-line interface to Google Cloud Platform. it is part of Google Cloud SDK.

Below are some basic usage.

1.) Getting help on commands.


VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud --help

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud compute --help

2.) To Know the versions.

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud version

Google Cloud SDK 206.0.0
bq 2.0.34
core 2018.06.18
gsutil 4.32
kubectl 

3.) To understand the Cloud SDK properties of active configuration.

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud config list
[compute]
region = us-east1
zone = asia-east1-a
[core]
account = xxxxxxxx@gmail.com
disable_usage_reporting = False
project = techproj-208207

Your active configuration is: [default]

4.)  To know installed components.

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud components list

Your current Cloud SDK version is: 206.0.0
The latest available version is: 210.0.0




4a.)To install or remove components at your current SDK version [206.0.0], run:
  
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID

4b.)To update your SDK installation to the latest version [210.0.0], run:

$ gcloud components update


5.)  To get the info of current gcloud environment.

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud info
Google Cloud SDK [206.0.0]

Platform: [Linux, x86] uname_result(system='Linux', node='molus-VirtualBox', release='4.15.0-23-generic', version='#25-Ubuntu SMP Wed May 23 17:59:24 UTC 2018', machine='i686', processor='i686')
Python Version: [3.6.5 (default, Apr  1 2018, 05:46:30)  [GCC 7.3.0]]
Python Location: [/usr/bin/python3]
Site Packages: [Disabled]

Installation Root: [/opt/google-cloud-sdk]
Installed Components:
  core: [2018.06.18]
  bq: [2.0.34]
  gsutil: [4.32]
  kubectl: []
System PATH: [/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin]
Python PATH: [/opt/google-cloud-sdk/lib/third_party:/opt/google-cloud-sdk/lib:/usr/lib/python36.zip:/usr/lib/python3.6:/usr/lib/python3.6:/usr/lib/python3.6/lib-dynload]
Cloud SDK on PATH: [False]
Kubectl on PATH: [/usr/local/bin/kubectl]

WARNING: There are old versions of the Google Cloud Platform tools on your system PATH.
  /usr/local/bin/kubectl

Installation Properties: [/opt/google-cloud-sdk/properties]
User Config Directory: [/home/molus/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/home/molus/.config/gcloud/configurations/config_default]

Account: [xxxxxxxxx@gmail.com]
Project: [techproj-208207]

Current Properties:
  [compute]
    zone: [asia-east1-a]
    region: [us-east1]
  [core]
    account: [pvnambiar@gmail.com]
    disable_usage_reporting: [False]
    project: [techproj-208207]

Logs Directory: [/home/molus/.config/gcloud/logs]
Last Log File: [/home/molus/.config/gcloud/logs/2018.08.07/12.46.35.767978.log]

git: [b'git version 2.17.1']
ssh: [b'OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017']



6.) List available regions.


7.) To get the description of region.

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud compute regions

describe asia-east1
creationTimestamp: '1969-12-31T16:00:00.000-08:00'
description: asia-east1
id: '1220'
kind: compute#region
name: asia-east1
quotas:
- limit: 24.0
  metric: CPUS
  usage: 0.0
- limit: 4096.0
  metric: DISKS_TOTAL_GB
  usage: 0.0
- limit: 8.0
  metric: STATIC_ADDRESSES
  usage: 0.0
- limit: 8.0
  metric: IN_USE_ADDRESSES
  usage: 0.0
- limit: 500.0
  metric: SSD_TOTAL_GB
  usage: 0.0
- limit: 6000.0
  metric: LOCAL_SSD_TOTAL_GB
  usage: 0.0
- limit: 100.0
  metric: INSTANCE_GROUPS
  usage: 0.0
- limit: 50.0
  metric: INSTANCE_GROUP_MANAGERS
  usage: 0.0
- limit: 240.0
  metric: INSTANCES
  usage: 0.0
- limit: 50.0
  metric: AUTOSCALERS
  usage: 0.0
- limit: 20.0
  metric: REGIONAL_AUTOSCALERS
  usage: 0.0
- limit: 20.0
  metric: REGIONAL_INSTANCE_GROUP_MANAGERS
  usage: 0.0
- limit: 0.0
  metric: PREEMPTIBLE_CPUS
  usage: 0.0
- limit: 0.0
  metric: NVIDIA_K80_GPUS
  usage: 0.0
- limit: 0.0
  metric: COMMITMENTS
  usage: 0.0
- limit: 200.0
  metric: INTERNAL_ADDRESSES
  usage: 0.0
- limit: 0.0
  metric: NVIDIA_P100_GPUS
  usage: 0.0
- limit: 0.0
  metric: PREEMPTIBLE_LOCAL_SSD_GB
  usage: 0.0
- limit: 0.0
  metric: PREEMPTIBLE_NVIDIA_K80_GPUS
  usage: 0.0
- limit: 0.0
  metric: PREEMPTIBLE_NVIDIA_P100_GPUS
  usage: 0.0
- limit: 0.0
  metric: NVIDIA_V100_GPUS
  usage: 0.0
- limit: 0.0
  metric: PREEMPTIBLE_NVIDIA_V100_GPUS
  usage: 0.0
- limit: 16.0
  metric: INTERCONNECT_ATTACHMENTS_PER_REGION
  usage: 0.0
- limit: 80000.0
  metric: INTERCONNECT_ATTACHMENTS_TOTAL_MBPS
  usage: 0.0
- limit: 5.0
  metric: RESOURCE_POLICIES
  usage: 0.0
- limit: 20.0
  metric: IN_USE_BACKUP_SCHEDULES
  usage: 0.0
selfLink: https://www.googleapis.com/compute/v1/projects/techproj-208207/regions/asia-east1
status: UP
zones:
- https://www.googleapis.com/compute/v1/projects/techproj-208207/zones/asia-east1-a
- https://www.googleapis.com/compute/v1/projects/techproj-208207/zones/asia-east1-b
- https://www.googleapis.com/compute/v1/projects/techproj-208207/zones/asia-east1-c


8.) To get the list of route.



9.) To get the description of routes.

VirtualBox:~/mybox/kubernetes/server/bin$ sudo gcloud compute routes describe default-route-0a7057a5d9a20883
creationTimestamp: '2018-06-24T02:27:19.128-07:00'
description: Default local route to the subnetwork 10.140.0.0/20.
destRange: 10.140.0.0/20
id: '6428811225324510488'
kind: compute#route
name: default-route-0a7057a5d9a20883
network: https://www.googleapis.com/compute/v1/projects/techproj-208207/global/networks/default
nextHopNetwork: https://www.googleapis.com/compute/v1/projects/techproj-208207/global/networks/default
priority: 1000
selfLink: https://www.googleapis.com/compute/v1/projects/techproj-208207/global/routes/default-route-0a7057a5d9a20883


No comments:

Post a Comment