2
2

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 1 year has passed since last update.

Kubernetesダッシュボードのデプロイ手順

Posted at

Kubernetesダッシュボードのデプロイ手順

  1. 使用するコンテキストを設定:
kubectl config use-context docker-desktop
  1. ダッシュボードのデプロイ:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml
  1. ServiceAccount、ClusterRoleBinding、そしてSecretを作成:
    • 以下の内容を create_service_account.yaml というファイルに保存します。
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kubernetes-dashboard
---
apiVersion: v1
kind: Secret
metadata:
  name: admin-user
  namespace: kubernetes-dashboard
  annotations:
    kubernetes.io/service-account.name: "admin-user"
type: kubernetes.io/service-account-token
  • 作成したYAMLファイルを適用します。
kubectl apply -f create_service_account.yaml
  1. ServiceAccountのトークンを取得:
kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d

このコマンドは、ログインに必要なBearerトークンを出力します。

  1. kubectlプロキシを起動:
kubectl proxy
  1. ブラウザでKubernetesダッシュボードにアクセス:

上記手順に従って、Kubernetesダッシュボードをデプロイし、ログインすることができます。

参照: https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?