3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

kubernetes/minikube/gke コマンド覚書

Last updated at Posted at 2018-03-08

kubernetes

起動中のサービスでコマンドを実行する

$ kubectl exec -it [pod_name] [command]

PODのログを表示する

$ kubectl logs (POD | TYPE/NAME) [CONTAINER_NAME]

deployment/serviceなどの作成

$ kubectl create -f [foo.yaml]

deployment/serviceなどの削除

$ kubectl delete -f [foo.yaml]

or

$ kubectl delete pod [pod_name]

(for pod)

deployment/serviceの再起動

$ kubectl replace --force -f <resource-file>

nginx secretの作成

$ kubectl create secret tls nginxsecret --key [foo.key] --cert [foo.crt]

nginx configmapの作成

$ kubectl create configmap nginxconfigmap --from-file=[default.conf]

PODのフォルダをローカルへコピー

$ kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar

デプロイしたファイルの編集

$ kubectl edit configmap/nginxconfigmap
$ kubectl edit deployment/backend
$ kubectl edit service/backend
$ kubectl edit replicationcontroller/frontend

デプロイしたファイルの履歴確認

$ kubectl describe configmap/nginxconfigmap
$ kubectl describe deployment/backend
$ kubectl describe service/backend
$ kubectl describe replicationcontroller/frontend

Podが削除されない場合の強制削除(*クラスタ内にプロセスが残ってしまう場合あり)

$ kubectl delete pod [Podの名前] --grace-period=0 --force

minikube

minikubeのスタート

$ minikube start

minikubeでローカルのDockerイメージを使いたい場合

$ eval $(minikube docker-env)

minikubeのserviceの状況をブラウザで表示

$ minikube service [service_name]

minikubeのダッシュボードをブラウザで見る

$ minikube dashboard

gcloud

GCRにDockerイメージをpushする

$ gcloud docker -- push gcr.io/[project_name]/[image_name]
3
3
0

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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?