kubernetes 20.04
참고글:
https://github.com/kubernetes/dashboard
https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md
1. recommend.yaml 다운로드
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
2. yaml 파일 수정
nano recommend.yaml
NodePort 를 이용해서 dashboard 포트를 지정할 계획
'- nodePort: 사용할 포트번호' 와 'type: NodePort' 를 아래처럼 추가
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
ports:
- nodePort: 31000 # 수정
port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
type: NodePort # 수정
3. deploy
kubectl apply -f recommend.yaml
4. pod 확인
kubectl get po -n kubernetes-dashboard
5. admin 계정 생성 (dashboard-admin.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
6. token 생성
kubectl -n kubernetes-dashboard create token admin-user
7. admin user 삭제
kubectl -n kubernetes-dashboard delete serviceaccount admin-user
kubectl -n kubernetes-dashboard delete clusterrolebinding admin-user
끝
'컴퓨터 > 클라우드 (Cloud)' 카테고리의 다른 글
kubernetes, helm, gpu monitoring 명령어 정리 (0) | 2023.02.06 |
---|---|
Ubuntu, kubernetes, nvidia gpu monitoring 정리 (0) | 2023.02.01 |
Ubuntu, Kubernetes Metallb 설치 정리 (0) | 2022.12.31 |
Ubuntu, Kubernetes Cluster 구성 정리 (0) | 2022.12.31 |
Docker 명령어 정리 (2) | 2022.12.27 |