by shigemk2

当面は技術的なことしか書かない

GCP

Cloud Loggingの料金体系メモ

GCP

ざっくりとしたアーキテクチャは公式の通り。 ログルーター経由でBQにデータを流す場合、 cloud.google.com ログルーターはユーザー定義のものを利用することになるが、ログルーター自体に料金は発生しない。ログの保存と一定期間以上の保持に料金が発生する…

storage.buckets.getのロール

GCP

Storage Insights コレクタ サービス(roles/storage.insightsCollectorService)でカバーできる権限であってroles/storage.objectAdminでも無理っていう cloud.google.com

サービスエージェント概要

GCP

Some Google Cloud services have Google-managed service accounts that allow the services to access your resources. These service accounts are known as service agents. If an API requires a service agent, then Google creates the service agent…

Compute Engine の汎用マシン ファミリー

GCP

用途で使い分けていく感じだけど、例えばE2だとこんな感じ トラフィック量の少ないウェブサーバー バックオフィス アプリ コンテナ化されたマイクロサービス 小規模データベース 仮想デスクトップ 開発環境とテスト環境 cloud.google.com

GKE ノードプール ノード

ノードプールは、クラスタ内で同じ構成を持つノードのグループ ノードは、コンテナ化されたアプリケーションと他のワークロードを実行するワーカーマシン 個々のマシンは、GKE が作成する Compute Engine 仮想マシン(VM) ノードプール > ノード で、ノード…

gsutil rsync

GCP

cloud.google.com 感覚的にはawscliのs3 syncと一緒かも docs.aws.amazon.com

gcloud composer environments list

GCP

cloud composerのenvironmentをlistするやつ パラメータは適宜 $ gcloud composer environments list --project=project-1 --locations=us-central1 cloud.google.com

terraform-google-secret-manager

そのうちterraform-google-modulesに移行しそうな気はしている github.com registry.terraform.io registry.terraform.io

Cloud Buildの変数 GitHub系

GCP

$TRIGGER_NAME: トリガーに関連付けられた名前 $COMMIT_SHA: ビルドに関連付けられた commit ID $REVISION_ID: ビルドに関連付けられた commit ID $SHORT_SHA: COMMIT_SHA の最初の 7 文字 $REPO_NAME: リポジトリの名前 $BRANCH_NAME: ブランチの名前 $TAG_…

Cloud Build env

GCP

トリガーでの設定はアンダースコア必須 steps: # Uses the ubuntu build step: # to run a shell script; and # set env variables for its execution - name: 'ubuntu' args: ['bash', './myscript.sh'] env: - 'BUILD=$BUILD_ID' - 'PROJECT_ID=$PROJECT_I…

Cloud BuildでTerraformのCICDするチュートリアル

ざっくり リポジトリにCloud Build GitHub appをインストール Cloud Build用のサービスアカウントを作成して、editor権限を付与 Cloud Buildからリポジトリに接続 Cloud Buildのトリガー作成 cloudbuild.yamlを書く cloud.google.com github.com

gcloud storage buckets

GCP

gcsをなんかあれこれするやつ cloud.google.com 転送速度はgsutilより早いらしいけどgsutilの機能が未実装なやつも多い cloud.google.com

cert-managerについて

Issuer 証明書発行者 複数namespaceにまたがって発行したい場合はClusterIssuerを使う Certificate 証明書 ACME Automate Certificate Management Environmentの略 cert-manager.io zenn.dev

コンテナ イメージ内のアプリを GKE クラスタにデプロイする

GCP

やること Hello World アプリを作成 Cloud Build を使用して、アプリをコンテナイメージにパッケージ化 Google Kubernetes Engine(GKE)でクラスタを作成 コンテナ イメージをクラスタにデプロイ YAMLの設定をデプロイ cloud.google.com

まっさらなプロジェクトでterraform-google-memorystoreでredisを立てる時のメモ

v6.0.0 module "redis_test_00001" { source = "terraform-google-modules/memorystore/google" version = "6.0.0" enable_apis = false name = "redis_test_00001" project = data.google_project.current.project_id connect_mode = "PRIVATE_SERVICE_ACCE…

An IP range in the local network (xxxxxxxxxxx) allocated by resource (xxxxxxxxxxxx) overlaps with an IP range (xxxxxxxxxxxx) in an active peer of the peer network.”

ピアリング接続を作成しようとしたらエラーが出た。 「注: ピアリングした VPC ネットワーク内のサブネットの IP 範囲は重複してはなりません。」 って注意されているんだから、ピアリングしたVPCネットワークでサブネットのIPが重複していたらダメだよね。 …

Existing secondary range cannot be modified

サブネットワークのセカンダリ ipv4 レンジをTerraformで更新しようとしたら失敗するやつ github.com 更新ができないなら削除して追加をTerraformの内々で実行すればいいんだろうけど、このIssueが起票されてから数年間ずっと緑が続いているのを考えると、諦…

gcloud container describe

GCP

GKEのクラスターとかノードプールとかのdescribe cloud.google.com cloud.google.com

terraform-google-memorystore

importするときはredis_versionは指定しなくてもいい read_replica_modeはtierがSTANDARD_HAの時に必要なパラメータだけど、空文字列で指定してもいい registry.terraform.io github.com

terraform-google-kubernetes-engine beta-private-cluster min_master_version

Minimum master kubernetes version ってあるけど、HCLを見るとrelease_channelがUNSPECIFIEDの場合はmaster_versionを見てて、master_versionはリージョン指定ありならkubernetes_versionか最新のバージョンを取得しようとしてる。ドキュメントが書かれてい…

Backup for GKE

GCP

ワークロードのバックアップと復元の機能 割と最近できたようでベータ版 APIとBackup for GKE エージェントが動く Terraformではgke_backup_agent_configで設定する cloud.google.com

compute_address vs compute_global_address

リージョン付きなのがcompute_addressで、リージョンなしなのがcompute_global_address registry.terraform.io registry.terraform.io

gcloud alpha bq datasets describe

GCP

これもalpha BigQuery cloud.google.com

gcloud alpha redis instances describe

GCP

memorystoreのredis instanceのdescribe。alphaで、memcacheも同じ。 cloud.google.com

terraform-google-memorystoreのread_replicas_mode

read_replicas_mode - (Optional) Optional. Read replica mode. Can only be specified when trying to create the instance. If not set, Memorystore Redis backend will default to READ_REPLICAS_DISABLED. HCL見てみると、tierがSTANDARD_HAが指定され…

gcloud container clusters describe

GCP

gcloud container clusters describe - describe an existing cluster for running containers 特にないですね 出力結果は200行を超えるYAMLだった cloud.google.com

Terraform を使用するためのベスト プラクティス importしない

マジか、と思ったけど、GKEなんかは特に感じる 可能であれば、(terraform import を使用して)既存のリソースをインポートすることは避けてください。手動で作成したリソースの来歴や構成を完全に把握することは困難です。代わりに Terraform を使用して新…

gcloud compute ssh

GCP

AWSでいうところのSSMとかいらないんだね cloud.google.com

自動作成されるファイアウォールルール

GCP

自動生成されるやつ cloud.google.com

gcloud compute firewall-rules list

GCP

formatのtable gcloud compute firewall-rules list --format="table( name, network, direction, priority, sourceRanges.list():label=SRC_RANGES, destinationRanges.list():label=DEST_RANGES, allowed[].map().firewall_rule().list():label=ALLOW, den…