LoginSignup
0

More than 1 year has passed since last update.

Kubernetesの便利コマンド

Posted at

基本コマンド

K・8・Sのプレイを確認するための比較的よく使うコマンドを紹介しよう。

Podに接続

開幕、クラスタに接続

gcloud container clusters get-credentials --zone=[ゾーン名] [CLUSTER名] --project [PROJECT名]

稼働中のPodを表示して、様子をうかがいつつ

kubectl get pod

ヒット確認後、Pod名を指定して実行

kubectl exec -it [PodのNAME] /bin/ash

※「/bin/ash」の部分は「/bin/bash」になったりもする。

この基本コンボでPod内に入ることができる。

再起動

一旦、距離をとって、Deployment等指定して再起動

kubectl rollout restart deploy [リソース名]

おまけ

パナシにはなるが、curlだけを使用できるリソース作成

kubectl run -it --rm=true busybox --image=yauritux/busybox-curl --restart=Never

現場からは以上です。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0