kubectl
kubectlはgcloudからインストールできるKubernetesを扱うコマンドラインツールです。gcloudからインストールします。
1 2 3 |
$ curl https://sdk.cloud.google.com | bash $ exec -l $SHELL $ gcloud init |
gcloudの中身を見てみます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
$ gcloud components list Your current Cloud SDK version is: 180.0.1 The latest available version is: 180.0.1 ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Components │ ├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤ │ Status │ Name │ ID │ Size │ ├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤ │ Not Installed │ App Engine Go Extensions │ app-engine-go │ 97.7 MiB │ │ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.0 MiB │ │ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │ │ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │ │ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 17.7 MiB │ │ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │ │ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │ │ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │ │ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │ │ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │ │ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │ │ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │ │ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 118.4 MiB │ │ Not Installed │ gcloud app PHP Extensions │ app-engine-php │ 21.9 MiB │ │ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.2 MiB │ │ Not Installed │ kubectl │ kubectl │ 12.2 MiB │ │ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │ │ Installed │ Cloud SDK Core Libraries │ core │ 7.5 MiB │ │ Installed │ Cloud Storage Command Line Tool │ gsutil │ 3.3 MiB │ └───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘ To install or remove components at your current SDK version [180.0.1], run: $ gcloud components install COMPONENT_ID $ gcloud components remove COMPONENT_ID To update your SDK installation to the latest version [180.0.1], run: $ gcloud components update |
kubectlはデフォルトでは入っていないので追加します。これでkubectlのインストールは完了です。
1 |
$ gcloud components install kubectl |
kube-prompt
kubectlを扱うのを楽にするkube-promptをbrewで入れます。これですぐに使えるようになります。
1 2 |
$ brew tap c-bata/kube-prompt $ brew install kube-prompt |
kubectlの使い方になれているなら説明がいらないくらい使い方が簡単です。
主な機能は下記になります。とにかくコマンドを使うのが楽になるので入れみてください。
- kubectlコマンドの補完機能
- podやserviceのリストアップ
おすすめ書籍
Dockerの使い方から説明されているので初心者の方も安心して学べる書籍です。
Kubernetesに関してはPod, Service, Deploymentなどを順を追って説明し、実際に動かすところまでを解説しているので非常に実践的な内容となっています。
これからKuebernetesを使ってサービスを開発してみたい方にとって最初のよい手助けとなると思います。是非読んでみてください。
posted with ヨメレバ
Kelsey Hightower,Brendan Burns,Joe Beda オライリージャパン 2018-03-22
The following two tabs change content below.
髙妻智一
2013年CyberAgent新卒入社
スマホゲームを作る子会社に所属し、サーバーサイドのエンジニアを担当。2年目の終わりから新規子会社の立ち上げに参加し、サーバーサイドのエンジニアリーダーとしてサービースのリリースから運用までを担当。
2018年仮想通貨のスマホウォレットを提供するGinco Incにブロックチェーンエンジニアとして入社。
最新記事 by 髙妻智一 (全て見る)
- 【無料公開】「Goで始めるBitcoin」3章 Bitcoinノードとの通信 技術書典8 - 2020-03-08
- エンジニアがゼロから技術ブログを書くための方法をまとめました - 2019-05-25
- FlutterからCloud Firestoreのデータを追加、更新、取得、削除する方法 - 2019-05-23
コメントを残す