45
38

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: コンテナイメージにログインする

Last updated at Posted at 2016-02-27

kubernetesで起動したコンテナにログインする方法

① pod名確認

$ kubectl get pod
NAME                   READY     STATUS    RESTARTS   AGE
nginx                1/1       Running   0          10m

② kubectl execコマンド実行

kubectl exec -it <Pod名> /bin/bash

ログオフする時はexitコマンド

$ kubectl exec -it nginx /bin/bash
root@nginx:/# 
root@nginx:/# ls
bin   dev  home  lib64	mnt  proc  run	 srv  tmp  var
boot  etc  lib	 media	opt  root  sbin  sys  usr
root@nginx:/# exit

kubectlコマンドが発行できるサーバ(Masterなど)でログインできる。

45
38
2

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
45
38

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?