mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(gcloud): improve article
This commit is contained in:
@@ -2,15 +2,56 @@
|
|||||||
|
|
||||||
CLI for the Google Cloud Platform.
|
CLI for the Google Cloud Platform.
|
||||||
|
|
||||||
## Table of contents <!-- omit in toc -->
|
|
||||||
|
|
||||||
1. [TL;DR](#tldr)
|
1. [TL;DR](#tldr)
|
||||||
1. [Further readings](#further-readings)
|
1. [Further readings](#further-readings)
|
||||||
1. [Sources](#sources)
|
1. [Sources](#sources)
|
||||||
|
|
||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
|
Properties can be set via environment variables following the format `CLOUDSDK_SECTIONNAME_PROPERTYNAME`.
|
||||||
|
|
||||||
|
| Variable | Default | Summary |
|
||||||
|
| ----------------------------- | --------------------------------------------- | --------------------------- |
|
||||||
|
| `CLOUDSDK_CONFIG` | `$HOME/.config/gcloud`<br/>`%APPDATA%\gcloud` | CLI configuration directory |
|
||||||
|
| `CLOUDSDK_CORE_PROJECT` | `` | Project |
|
||||||
|
| `CLOUDSDK_COMPUTE_ZONE` | `` | Compute zone |
|
||||||
|
| `CLOUDSDK_ACTIVE_CONFIG_NAME` | `` | Active configuration |
|
||||||
|
|
||||||
|
| Path | Summary | Notes |
|
||||||
|
| ------------------------------------------------------- | ------------------------------- | ---------------- |
|
||||||
|
| `$CLOUDSDK_CONFIG` | CLI configuration directory | Must be writable |
|
||||||
|
| `$CLOUDSDK_CONFIG/configurations/config_default` | Default configuration | |
|
||||||
|
| `$CLOUDSDK_CONFIG/application_default_credentials.json` | Default application credentials | |
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Setup</summary>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
# Install.
|
||||||
|
asdf plugin add 'gcloud' && asdf install 'gcloud' 'latest'
|
||||||
|
|
||||||
|
# [optional if one know what they're doing] Initialize.
|
||||||
|
gcloud init
|
||||||
|
gcloud init --no-browser
|
||||||
|
gcloud --configuration 'secondary' init --console-only
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Usage</summary>
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Show information about the installation and the active configuration.
|
||||||
|
gcloud info
|
||||||
|
gcloud info --format='value(config.paths.global_config_dir)'
|
||||||
|
|
||||||
|
# Show information about gcloud commands and other topics.
|
||||||
|
gcloud help
|
||||||
|
gcloud help compute instances create
|
||||||
|
gcloud cheat-sheet
|
||||||
|
|
||||||
|
|
||||||
# Login.
|
# Login.
|
||||||
gcloud auth login
|
gcloud auth login
|
||||||
gcloud … --brief
|
gcloud … --brief
|
||||||
@@ -62,6 +103,16 @@ gcloud config configurations list
|
|||||||
gcloud config configurations activate "old_profile"
|
gcloud config configurations activate "old_profile"
|
||||||
|
|
||||||
|
|
||||||
|
# Update the SDK installation to the latest version.
|
||||||
|
gcloud components update
|
||||||
|
|
||||||
|
# Install components.
|
||||||
|
gcloud components install 'skaffold'
|
||||||
|
|
||||||
|
# Remove components.
|
||||||
|
gcloud components remove 'config-connector'
|
||||||
|
|
||||||
|
|
||||||
# List all project the current user has access to.
|
# List all project the current user has access to.
|
||||||
gcloud projects list --sort-by='projectId'
|
gcloud projects list --sort-by='projectId'
|
||||||
|
|
||||||
@@ -124,16 +175,17 @@ gcloud config set account "serviceaccount@gcpproject.iam.gserviceaccount.com" \
|
|||||||
&& gcloud compute instances list
|
&& gcloud compute instances list
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Further readings
|
## Further readings
|
||||||
|
|
||||||
- [Creating and managing projects]
|
- [Creating and managing projects]
|
||||||
- [Install kubectl and configure cluster access]
|
- [Install kubectl and configure cluster access]
|
||||||
- [`gcloud config configurations`][gcloud config configurations]
|
- [`gcloud config configurations`][gcloud config configurations]
|
||||||
|
|
||||||
## Sources
|
### Sources
|
||||||
|
|
||||||
All the references in the [further readings] section, plus the following:
|
|
||||||
|
|
||||||
|
- [Install the Google Cloud CLI]
|
||||||
- [Reference]
|
- [Reference]
|
||||||
- [Cheat-sheet]
|
- [Cheat-sheet]
|
||||||
- [How to run gcloud command line using a service account]
|
- [How to run gcloud command line using a service account]
|
||||||
@@ -148,11 +200,9 @@ All the references in the [further readings] section, plus the following:
|
|||||||
[creating and managing projects]: https://cloud.google.com/resource-manager/docs/creating-managing-projects
|
[creating and managing projects]: https://cloud.google.com/resource-manager/docs/creating-managing-projects
|
||||||
[gcloud config configurations]: https://cloud.google.com/sdk/gcloud/reference/config/configurations
|
[gcloud config configurations]: https://cloud.google.com/sdk/gcloud/reference/config/configurations
|
||||||
[install kubectl and configure cluster access]: https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl
|
[install kubectl and configure cluster access]: https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl
|
||||||
|
[install the google cloud cli]: https://cloud.google.com/sdk/docs/install-sdk
|
||||||
[reference]: https://cloud.google.com/sdk/gcloud/reference/
|
[reference]: https://cloud.google.com/sdk/gcloud/reference/
|
||||||
|
|
||||||
<!-- In-article sections -->
|
|
||||||
[further readings]: #further-readings
|
|
||||||
|
|
||||||
<!-- Others -->
|
<!-- Others -->
|
||||||
[how to change the active configuration profile in gcloud]: https://stackoverflow.com/questions/35744901/how-to-change-the-active-configuration-profile-in-gcloud#35750001
|
[how to change the active configuration profile in gcloud]: https://stackoverflow.com/questions/35744901/how-to-change-the-active-configuration-profile-in-gcloud#35750001
|
||||||
[how to run gcloud command line using a service account]: https://pnatraj.medium.com/how-to-run-gcloud-command-line-using-a-service-account-f39043d515b9
|
[how to run gcloud command line using a service account]: https://pnatraj.medium.com/how-to-run-gcloud-command-line-using-a-service-account-f39043d515b9
|
||||||
|
|||||||
Reference in New Issue
Block a user