Ubuntu 26.04

Kubernetes : ダッシュボードを有効にする2026/05/13

 

ダッシュボードを有効にして、Web UI で Kubernetes クラスターの管理ができるようにします。

当例では以下のように 4 台のノードを使用して Kubernetes クラスターを構成しています。

+----------------------+   +----------------------+
|  [ ctrl.srv.world ]  |   |   [ dlp.srv.world ]  |
|     Manager Node     |   |     Control Plane    |
+-----------+----------+   +-----------+----------+
        eth0|10.0.0.25             eth0|10.0.0.30
            |                          |
------------+--------------------------+-----------
            |                          |
        eth0|10.0.0.51             eth0|10.0.0.52
+-----------+----------+   +-----------+----------+
| [ node01.srv.world ] |   | [ node02.srv.world ] |
|     Worker Node#1    |   |     Worker Node#2    |
+----------------------+   +----------------------+

[1]

こちらを参考に Helm をインストールしておきます。

[2] Headlamp ダッシュボードをインストールします。
ubuntu@ctrl:~$
helm repo add headlamp https://kubernetes-sigs.github.io/headlamp/

"headlamp" has been added to your repositories
# ダッシュボード用のネームスペース作成

ubuntu@ctrl:~$
kubectl create namespace dashboard

namespace/dashboard created
ubuntu@ctrl:~$
helm install headlamp headlamp/headlamp -n dashboard

NAME: headlamp
LAST DEPLOYED: Wed May 13 00:27:02 2026
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace dashboard -l "app.kubernetes.io/name=headlamp,app.kubernetes.io/instance=headlamp" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace dashboard $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace dashboard port-forward $POD_NAME 8080:$CONTAINER_PORT
2. Get the token using
  kubectl create token headlamp --namespace dashboard

ubuntu@ctrl:~$
kubectl get pods -n dashboard

NAME                        READY   STATUS    RESTARTS   AGE
headlamp-55f6747596-dzknq   1/1     Running   0          44s
[3] ダッシュボード用のセキュリティトークンを取得して、ダッシュボードにアクセスできるように設定します。
# headlamp アカウントのセキュリティトークン取得

ubuntu@ctrl:~$
kubectl create token headlamp -n dashboard

eyJhbGciOiJSUzI1NiIsI.....

# ダッシュボードアクセス用にポートフォワードをセット

ubuntu@ctrl:~$
kubectl port-forward -n dashboard service/headlamp --address 0.0.0.0 8443:80

Forwarding from 0.0.0.0:8443 -> 8443
[4]

ローカルネットワーク内の任意のコンピューターで Web ブラウザーを起動して、以下の URL にアクセスします。

⇒ http://(Manager ノードのホスト名 または IP アドレス):(設定したポート)/

アクセス後、以下のような画面が表示されたら、[3] で取得したセキュリティトークンを コピー & ペーストして [Sing In] ボタンをクリックします。
[5] 認証が成功すると Kubernetes クラスターのダッシュボードが表示されます。
関連コンテンツ