Leanpub Header

Skip to main content

みんなのKubernetes

ゼロからデータセンターを構築する

みんなのKubernetes

多くのKubernetesの本はYAMLを教えます。この本はデータセンターの作り方を教えます。#!/usr/bin/env bashから始めて、完全なマルチサービスクラスターを構築・再読み込み・破棄する1つのコマンドにたどり着きます。魔法もブラックボックスもありません。

This book is a translation into Japanese of Kubernetes for All which was originally written in English

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
About

About

About the Book

開発者体験はインフラです。毎日リリースできるチームとデプロイを恐れるチームの違いは、才能ではなくツールであることがほとんどです。高速なフィードバックループ、イミュータブルなデプロイ、自己修復するクラスター、可観測なシステム。

多くのKubernetesチュートリアルはkubectl applyで終わります。欠けているのはそれらをつなぐ仕組みです。数秒でクラスターを作り、イメージを再ビルドし、接続を切らずにサービスをリロードし、失敗の原因を正確に教えてくれる、再現可能なワークフローです。

『みんなのKubernetes』は、完全なクラウドネイティブ基盤を自分で作りながらKubernetesを基礎から学ぶ本です。1つのBashスクリプトでマルチノード環境を構築し、アプリのデプロイ、運用の自動化、GitOps、PrometheusとGrafanaによる可観測性、OpenTelemetryによる分散トレースまでを実装します。

Kind、Helm、Pod、Deployment、Service、Ingress、ConfigMap、Secret、永続ボリューム、StatefulSet、Kubernetes APIを扱います。最終的に、datacenter.shが16のマイクロサービス、PostgreSQL、KRaftモードのKafka、Webフロントエンドをデプロイします。

理解し、改変し、信頼できるKubernetesツールを求めるエンジニアのための本です。Kubernetesの経験は不要。Docker、Kind、ターミナル、そして本物を作りたいという気持ちがあれば十分です。

Share this book

This book is a translation into Japanese of Kubernetes for All which was originally written in English

Author

About the Author

Joel Bryan Juliano

Hi, I'm Joel.

I am Dutch-Filipino Software Engineer with 20+ years of experience.

And with over 20 years in the game, I’ve seen it all and loved every minute of it.

My journey has taken me through a variety of industries, from sports streaming to cybersecurity, both in the private sector and for the Dutch government, and everything in between.

Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.

Translations

Translations

Contents

Table of Contents

はじめに:Bash で Kubernetes を 接着する

  1. 前提条件
  2. なぜ Bash なのか
  3. 私たちが 構築するもの
  4. エントリー ポイント:setup.sh
  5. datacenter.sh の 開始
  6. ハンズオン 演習

セーフティ 設定、初期化、および ライフサイクル フック

  1. グローバル set オプション
  2. シェル スクリプトの lint: shellcheck
  3. スクリプトの 初期化
  4. メイン コントローラ
  5. エラー ハンドラ
  6. 終了 ハンドラ
  7. まとめ
  8. 実践 演習

終了 コードと 制御された 終了

  1. script_exit 関数
  2. 終了 コードの 規約
  3. Bash 安全 パターンの 復習
  4. 更新 された スクリプト
  5. 実践 演習

Cron モードと IO リダイレクション

  1. Cron モードの 動作
  2. ファイル 記述子
  3. Cron モードの ための リダイレクト
  4. エラー ハンドラの 更新
  5. 終了 ハンドラの 更新
  6. main への cron_init の 登録
  7. 更新 された スクリプト
  8. 実践 演習

ライブラリ パターン: Bash コード ベースの 整理

  1. lib/ ディレクトリ
  2. main での ライブラリ 読み込み
  3. ライブラリ ファイルの 書き方
  4. 命名 規則
  5. 依存 関係 グラフ
  6. 今 知って おく 価値の ある 2 つの ユーティリティ ライブラリ
  7. 実践 演習

端末の 色と ログ 出力

  1. ログ ライブラリ
  2. 色の 初期化
  3. log 関数
  4. verbose_print — 詳細 モード 出力
  5. init の 更新
  6. main の 更新
  7. エラー ハンドラの 更新
  8. 実践 演習

検証 ヘルパーと バイナリ チェック

  1. lib/script.sh
  2. check_binary — 必須 ツールの 検出
  3. check_required_binaries — システム 前提 条件
  4. is_kind — モード 検出
  5. check_arguments — 変数 存在の 検証
  6. check_directories — パス 検証
  7. check_files — ファイル 存在の 検証
  8. check_repos — リポジトリ 存在 ガード
  9. build_path — PATH 構築
  10. init チェーンでの ヘルパー 使用
  11. 実践 演習

設定 管理

  1. 設定 ファイル
  2. lib/config.sh
  3. get_configurations — 対話型 セットアップ
  4. main での 設定の 読み取り
  5. Docker ネットワーク モード
  6. 実践 演習

スクリプト ロック: 同時 実行の 防止

  1. ファイルでは なく ディレクトリを 使う 理由
  2. lock_init
  3. 古い ロックの 処理
  4. 実践 演習

完全 な パラメータ 解析

  1. parse_params
  2. script_usage — ヘルプ テキスト
  3. parse_params を main に 接続 する
  4. 実践 演習

ローカル モード と Kind クラスタ 管理

  1. なぜ Kind か
  2. lib/kind.sh
  3. start_env — Kind クラスタ の 作成
  4. stop_env — クラスタ の 停止
  5. delete_env — クラスタ の 破棄
  6. Kind へ の イメージ の 読み込み
  7. Docker 環境 の 切り替え 不要
  8. 実践 演習

Docker 操作

  1. lib/docker.sh
  2. safe_docker — ベース ラッパー
  3. safe_docker_build — イメージ の ビルド
  4. safe_docker_run — コンテナ の 実行
  5. Kind へ の イメージ 読み込み
  6. Docker Compose 操作
  7. docker_cleanup — 停止 コンテナ と イメージ の 削除
  8. 実践 演習

kubectl に よる Kubernetes 操作

  1. lib/kubectl.sh
  2. safe_kubectl — ベース ラッパー
  3. kubectl_install_resource_from_file
  4. kubectl_install_database — PostgreSQL セットアップ
  5. kubectl_restart — ローリング 再起動
  6. DNS 管理
  7. 全て の Deployment の 再起動
  8. 実践 演習

Helm : Kubernetes の パッケージ 管理

  1. lib/helm.sh
  2. safe_helm — ベース ラッパー
  3. k8s/ 内 の Helm チャート
  4. helm_install_service — 汎用 サービス インストーラー
  5. helm_install_core_service — テンプレート ベース サービス
  6. Config リリース の インストール
  7. 更新 関数 — その場 アップグレード
  8. Traefik — Ingress コントローラー
  9. 実践 演習

サービス の ビルド

  1. ビルド パイプライン
  2. lib/build.sh
  3. build_service — コア ビルド 関数
  4. サービス グループ 関数
  5. build_images_init — ビルド ディスパッチャ
  6. lib/install_deps.sh
  7. check_registry
  8. 実践 演習

ゼロ から の プロビジョニング

  1. システム アーキテクチャ
  2. 完全 な プロビジョニング シーケンス
  3. ステップ バイ ステップ
  4. サポート 関数
  5. Kubernetes クラスタ パラメータ
  6. Kubernetes マニフェスト リファレンス
  7. 実践 演習
  8. 成功 の 姿

リロード と 復旧 操作

  1. lib/reload_services.sh
  2. reload_services — 軽量 サービス リフレッシュ
  3. reload_services_init — リロード ディスパッチャ
  4. lib/reload_kubernetes.sh
  5. reload_all_kubernetes — 完全 クラスタ 再構築
  6. 実践 演習

解体 と クリーンアップ

  1. 環境 の 停止
  2. 環境 の 削除
  3. 完全 な Kubernetes 解体
  4. Docker クリーンアップ
  5. 終了 ハンドラ : 完全 版
  6. 完全 な スクリプト を まとめる
  7. 完全 な main() 関数
  8. 完全 な init 関数
  9. 完全 な ライフサイクル
  10. あなた が 構築 し た 開発者 体験
  11. 実践 演習

ArgoCD による GitOps

  1. lib/argocd.sh
  2. safe_argocd — 基本ラッパー
  3. helm_install_argocd — コントローラーのインストール
  4. argocd_wait_ready — 起動の確認
  5. argocd_login — CLI の認証
  6. argocd_create_app — アプリケーションの登録
  7. argocd_sync — 同期の開始
  8. argocd_wait_healthy — 同期完了の待機
  9. argocd_delete_app — アプリケーションの削除
  10. ArgoCD を datacenter.sh に組み込む
  11. OpenShift に関する注意
  12. 実践演習

Prometheus と Grafana によるメトリクスとダッシュボード

  1. lib/monitoring.sh
  2. helm_install_monitoring — フルスタック
  3. monitoring_wait_ready — 起動の確認
  4. monitoring_port_forward — ローカルからのアクセス
  5. monitoring_apply_servicemonitor — サービスをスクレイプする
  6. monitoring_get_grafana_password — 認証情報の取得
  7. 監視を datacenter.sh に組み込む
  8. kube-prometheus-stack が提供するもの
  9. 実践演習

OpenTelemetry による分散トレーシング

  1. lib/otel.sh
  2. safe_otel — 基本ラッパー
  3. helm_install_otel_operator — operator のインストール
  4. otel_wait_ready — operator が動作していることの確認
  5. otel_apply_collector — コレクターのデプロイ
  6. otel_apply_instrumentation — コードを変更しない自動計装
  7. otel_wait_collector_ready — コレクターの確認
  8. Grafana Tempo — トレースのバックエンド
  9. OTel を datacenter.sh に組み込む
  10. トレース、メトリクス、ログをつなぐ
  11. 実践演習

付録 : datacenter.sh コマンド リファレンス

  1. setup.sh
  2. datacenter.sh
  3. 終了 コード
  4. チェーン 可能 vs チェーン 不可 パラメータ
  5. 一般的 な ワークフロー
  6. トラブルシューティング

用語集

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub