0% found this document useful (0 votes)
23 views2 pages

Gcloud

Uploaded by

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

Gcloud

Uploaded by

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

gcloud container clusters resize --zone us-central1-a in28mins-cluster --num-

nodes=0

(see separate kubectl file for kubectl commands)

Shortcuts
-----------
alias gconf='gcloud config list' - show current user
alias gconfs='gcloud config configurations list' - show all users
alias gactive='gcloud config configurations activate' - activate a user
alias gproj='gcloud set project' - activate a proj in
a user

e.g. To activate the apt-1 user:


gactive apt-1

-------
Configs
-------
gcloud init [ Create a brand new
configuration]
gcloud config configurations create <id> [ Create a new empty
configuration]
gcloud config configurations activate <id> [ Activate a configuration]
gcloud set project <pid> [ Active a project for
current user]

gcloud config configurations list [ list all configs / users]


gcloud config list [ view current config -
user, project etc ]
gcloud config set [ set prop on current
config ???]

gcloud info [ verbose info, incl. path


of config file]
gcloud info --format='value(config)' [ info in json style]
gcloud info [ parse json style]
--format='value(config.properties.compute.zone)'

gcloud compute project-info add-metadata \ [ change default


region or zone]
--metadata google-compute-default-region=europe-west1,\
google-compute-default-zone=europe-west1-b

---------------
- GKE -
---------------
gcloud container clusters create <cid> [ create a cluster in the
default zone]
gcloud container clusters create <cid> --zone=<zid> [ create clust in zone]

gcloud container clusters list [ list cluster details,


including <id>]
gcloud container clusters describe <cid> [ verbose details of
cluster in YAML]

gcloud container clusters get-credentials <cid> --zone=<zone>


[ initialises kubeconf in
HOME/.kube/config:
enables switching to a
specific cluster, when working with multiple clusters. It can also be used to
access a previously created cluster from a new workstation.]

----------------------
Delete all resources
----------------------

gcloud projects delete <pid> [ shuts down project, schedules


it for deletion.]

If you're using Google Cloud and would like to delete your project (and associated
resources, including any GKE clusters)

- Go to the Projects page in the Cloud Console


- Select the project you created for this Quickstart and
- click on the trash can icon next to delete it

--------
Compute - instance name must be: [a-z]([-a-z0-9]*[a-z0-9])?
--------
Instance Names + Prices
- https://cloud.google.com/sdk/gcloud/reference/compute/instances/create
- https://cloud.google.com/compute/vm-instance-pricing
- https://cloud.google.com/products/calculator

gcloud compute instances create [INSTANCE_NAME] --machine-type=n1-standard-1


--zone=us-central1-b --preemptible --no-restart-on-failure --maintenance-
policy=terminate

gcloud compute instances describe [INSTANCE_NAME]

gcloud command-line executables


===============================

gcloud components list [ list of executables' IDs eg.


kubectl]
gcloud components install <id> [ install an executable]
gcloud components remove <id> [ uninstall an executable]

You might also like