.. _gcloud: ====== gcloud ====== ``gcloud`` is a command-line tool that lets us the command line to perform Google Cloud tasks such as cluster provisioning, as an alternative to use the web UI. See [gcloud-01]_ for an overview and useful links (installation, etc.) and [gcloud-02]_ for a complete reference of gcloud commands. Once installed, we can run the following regularly to update to the latest version: .. code-block:: none > gcloud components update In order to use gcloud with your account, use the ``gcloud init`` command. This will open a browser window to login to authorize google cloud SDK to use your account, this will also set project and zone. Settings will be saved in a config file (``~/.config/gcloud/configurations/config_default``) .. code-block:: none > gcloud init To create a cluster, first set a project and zone for it using the corresponding gcloud commands (note: this is not needed if those were already set with ``gcloud init``): .. code-block:: none > gcloud config set project [PROJECT_ID] > gcloud config set compute/zone us-central1-b Then create the cluster: .. code-block:: none > gcloud container clusters create mycluster --num-nodes=1 To get cluster info: .. code-block:: none > gcloud container clusters list > gcloud container clusters describe opsdash If you are using an existing Kubernetes Engine cluster or if you have created a cluster through Google Cloud Platform Console, you need to run the following command to retrieve cluster credentials and configure kubectl command-line tool with them: .. code-block:: none > gcloud container clusters get-credentials ---------- References ---------- .. [gcloud-01] `gcloud command-line tool overview `_ (Retrieved 2019-09-17) .. [gcloud-01] `gcloud reference `_ (Retrieved 2019-09-23)