LoginSignup
9
10

More than 3 years have passed since last update.

[Docker for Windows]Kubernetesを動かしてみる

Last updated at Posted at 2019-05-21

やること

  • kubernetesのダッシュボードを起動させるところまで

環境

  • Windows 10 Pro
  • Docker for Windows
  • PowerShell

実行手順

起動確認

powershell
PS> kubectl config get-contexts
CURRENT   NAME                 CLUSTER                      AUTHINFO             NAMESPACE
*         docker-for-desktop   docker-for-desktop-cluster   docker-for-desktop

context切り替え

  • 使用するクラスタをdocker-for-desktopに切り替える
powershell
PS> kubectl config use-context docker-for-desktop
Switched to context "docker-for-desktop".

master(Docker for windowsが起動しているPC)が1台起動している

powershell
PS> kubectl get nodes
NAME                 STATUS    ROLES     AGE       VERSION
docker-for-desktop   Ready     master    22h       v1.10.11

動作しているpodを確認

powershell
PS> kubectl get po --all-namespaces
NAMESPACE     NAME                                         READY     STATUS    RESTARTS   AGE
docker        compose-74649b4db6-8md2t                     1/1       Running   1          22h
docker        compose-api-5fdd448dcf-x4vd2                 1/1       Running   1          22h
kube-system   etcd-docker-for-desktop                      1/1       Running   1          22h
kube-system   kube-apiserver-docker-for-desktop            1/1       Running   2          22h
kube-system   kube-controller-manager-docker-for-desktop   1/1       Running   1          22h
kube-system   kube-dns-86f4d74b45-jgzdn                    3/3       Running   3          22h
kube-system   kube-proxy-8phd7                             1/1       Running   1          22h
kube-system   kube-scheduler-docker-for-desktop            1/1       Running   1          22h

kubernetes-dashboardのデプロイ

powershell
PS> kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml

アクセストークンの発行

powershell
PS> $TOKEN=((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]
PS> kubectl config set-credentials docker-for-desktop --token="${TOKEN}"

ダッシュボードを起動しアクセス

powershell
PS> kubectl proxy
Starting to serve on 127.0.0.1:8001

2019-05-21_23h32_25.png

2019-05-21_23h34_56.png

  • 無事アクセスが出来ました。
  • powersellで行いましたが、手順の最初からWSLで実施する方法もあるようです。
9
10
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
9
10