감사합니다.
Single k8s Master - dashboard 설치하기 본문
https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
공식 사이트 및 블로그 문서 참고하여 k8s 대시 보드 만드는 절차를 작성해 보았다.
1. Deploying the Dashboard UI
admin@ubuntuk8s:~$kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
2. 계정 생성
# service account 생성
admin@ubuntuk8s:~$cat serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
admin@ubuntuk8s:~$kubectl apply -f serviceaccount.yaml
# cluster role binding
admin@ubuntuk8s:~$cat ClusterRoleBinding.yaml
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
admin@ubuntuk8s:~$kubectl apply -f ClusterRoleBinding.yaml
#long-lived bearer token 생성
admin@ubuntuk8s:~$cat secret.yaml
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
kubectl apply -f secret.yaml
# secret 확인
admin@ubuntuk8s:~$kubectl get secret admin-user -n kubernetes-dashboard -o jsonpath={".data.token"} | base64 -d
3. Dashboard service 생성
admin@ubuntuk8s:~$cat dashboard-service.yaml
apiVersion: v1
kind: Service
metadata:
name: k8s-dashboard-service
namespace: kubernetes-dashboard
labels:
k8s-app: kubernetes-dashboard
spec:
type: NodePort
ports:
- nodePort: 32767
port: 10443
targetPort: 8443
protocol: TCP
name: http
selector:
k8s-app: kubernetes-dashboard
admin@ubuntuk8s:~$kubectl apply -f dashboard-service.yaml
service 를 사용하는 방법이 가장 좋아 보인다. 32767 포트로 접속하기 위한 service를 작성하였다.
4. Browser 접속 확인
https://서버IP:32767 주소로 접속
5. Remove the admin ServiceAccount and ClusterRoleBinding
kubectl -n kubernetes-dashboard delete serviceaccount admin-user
kubectl -n kubernetes-dashboard delete clusterrolebinding admin-user
'Kubernetes 따라하기' 카테고리의 다른 글
How to install a multi master Kubernetes Cluster (0) | 2023.09.13 |
---|---|
Kubernetes on Ubuntu 22.04 - Single Master - kubeadm (0) | 2023.09.11 |
AKS, Azure Kubernetes - Dashboard ; Can not find kubectl executable in PATH (0) | 2018.06.20 |
minikube - 단일 노드 클러스터 생성하기 part3 (1) | 2018.06.18 |
minikube - 단일 노드 클러스터 생성하기 part2 (0) | 2018.06.18 |
minikube - 단일 노드 클러스터 생성하기 part 1 (0) | 2018.06.18 |