0
0

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.

Amazon EKSでKubernetesダッシュボードを利用する

Last updated at Posted at 2022-10-23

はじめに

Amazon EKSで Kubernetes ダッシュボード を利用する方法をまとめます。
Mac環境を想定しています。

今回のバージョンは v2.7.0 を想定しています。

最新のバージョンに関しては、release を確認してください。

実行環境の準備

  1. AWS CLIの設定
    AWS CloudFormationを動かすためのAWS CLIの設定を参考にしてください。

  2. EKSクラスタの構築
    Macでeksctlを利用してAmazon EKSのクラスターを構築するを参考にしてください。

  3. EKSのコンテキストの設定
    MacにてAmazon EKSの設定をするを参考にしてください。

環境設定

  1. Kubernetesダッシュボードをクラスターに適用する
    ※事前にKubernetesクラスターのコンテキストの設定をします。

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
    
  2. eks-admin-service-account.yaml を作成する
    ※サービスアカウント(eks-admin)とクラスターロールバインディング(RBAC:Role Based Access Control)を作成する

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: eks-admin
      namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: eks-admin
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cluster-admin
    subjects:
    - kind: ServiceAccount
      name: eks-admin
      namespace: kube-system
    
  3. クラスターに適用する

    kubectl apply -f eks-admin-service-account.yaml
    
  4. サービスアカウント(eks-admin)の認証トークンを取得する

    kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')
    
  5. Kubernetesダッシュボードを起動する

    kubectl proxy
    
  6. Kubernetesダッシュボードにアクセスする

    open "http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/"
    

クリーンアップ

  1. クラスターからで削除する

    kubectl delete -f eks-admin-service-account.yaml
    
  2. Kubernetesダッシュボードをクラスターから削除する

    kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
    

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?