40
40

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にDashboardをインストールして、認証なしでアクセスする

Last updated at Posted at 2018-04-13

社内の開発環境用のKubernetes Dashboardであれば、認証なし(tokenの入力なし)でアクセスしたいですよね。
そのための手順です。

1. Dashboardをインストール

$ wget https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/alternative/kubernetes-dashboard.yaml

# Serviceをtype: NodePortに変更
$ vim kubernetes-dashboard.yaml
・・・
    namespace: kube-system
  spec:
+   type: NodePort #これを追加
    ports:
    - port: 80


$ kubectl apply -f  kubernetes-dashboard.yaml

2. Dashboard Service Accountに管理権限を与える

$ cat <<EOF | kubectl create -f -
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: kubernetes-dashboard
  labels:
    k8s-app: kubernetes-dashboard
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: kubernetes-dashboard
  namespace: kube-system
EOF

3. Dashboardにアクセス

MasterNodeのIPとkubernetes-dashboard ServiceのPortをもとにアクセスする。httpsじゃなくhttpでアクセスすること。
認証なし(tokenの入力なし)でダッシュボードがみれる。

スクリーンショット 2018-04-13 22.25.03.png

認証ありのインストール手順例

1, https://github.com/kubernetes/dashboard/wiki/Installation の"Recommended setup"を実行
2, https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard---1.7.X-and-above#nodeport のNodePortのセクションを実行
3, https://github.com/kubernetes/dashboard/wiki/Access-control#bearer-token を参考に、service accountのtokenを取得
4, ダッシュボードを開きtokenを入力


参考: https://stackoverflow.com/questions/46664104/how-to-sign-in-kubernetes-dashboard

40
40
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?