1)以下のコマンドで、arm用のyamlファイルの取得を行う。
curl https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml | sed "s/amd64/arm/g" > kubernetes-dashboard.yaml
2)dashboardの作成を行う。
kubectl apply -f kubernetes-dashboard.yaml
3)サービスアカウントのyamlの作成を行う。
vi service-account.yaml
=============================================
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kube-system
=============================================
4)アカウントの作成を行う。
kubectl apply -f service-account.yaml
5)トークンコードを調べるために、以下のユーザーIDを確認する。
kubectl -n kube-system get secret | grep admin-user
==============================================================
admin-user-token-lwf2g kubernetes.io/service-account-token 3 12m
================================================================
6)以下のコマンドで、トークンコードを表示させる。
kubectl -n kube-system describe secret admin-user-token-lwf2g
======================================================================
Data
====
ca.crt: 1025 bytes
namespace: 11 bytes
token: ****************** <———ログイン時に必要なので控えておく!
======================================================================
7)このままだと、ローカルIP経由のみのアクセスしか出来ないので、以下の変更を行う。
kubectl -n kube-system edit service kubernetes-dashboard
=====================================================================
apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"k8s-app":"kubernetes-dashboard"},"name":"kubernetes-dashboard","namespace":"kube-system"},"spec":{"ports":[{"port":443,"targetPort":8443}],"selector":{"k8s-app":"kubernetes-dashboard"}}}
creationTimestamp: "2019-06-19T14:27:53Z"
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
resourceVersion: "925201"
selfLink: /api/v1/namespaces/kube-system/services/kubernetes-dashboard
uid: 6c7bf2cf-929e-11e9-ab4f-b827eb29cf3e
spec:
clusterIP: 10.106.13.164
externalTrafficPolicy: Cluster
ports:
- nodePort: 30193
port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
sessionAffinity: None
type: NodePort <————ローカルIP以外からもアクセス可能にするためにNodePortに変更。
status:
loadBalancer: {}
==========================================================================
8)dashboardのポート番号を調べる。
root@rasp-master:~# kubectl -n kube-system get service kubernetes-dashboard
=====================================================================================
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes-dashboard NodePort 10.106.13.164 <none> 443:30193/TCP 23m
=====================================================================================
ブラウザで、以下の方法でアクセスを行う。
0 件のコメント:
コメントを投稿