Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install dashboard in kubernetes

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to install dashboard in kubernetes. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Download the latest and corresponding yaml. Https://github.com/kubernetes/dashboard/releases

Wget-O k8s-dashboard.yaml https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml

Modify the k8s-dashboard.yaml according to the actual situation. Export nodePort directly and add two lines. As follows

Kind: ServiceapiVersion: v1metadata: labels: k8s-app: kubernetes-dashboard name: kubernetes-dashboard namespace: kubernetes-dashboardspec: type: NodePort ports:-port: 443 targetPort: 8443 nodePort: 30001 selector: k8s-app: kubernetes-dashboard

Custom https (https://github.com/kubernetes/dashboard/blob/master/docs/user/installation.md)

# refer to https://my.oschina.net/u/160697/blog/4602174cd ~ curl-s https://get.acme.sh | set aliases for sh# to facilitate the use of the command alias acme.sh=~/.acme.sh/acme.sh# to export aliyun key Need to add export Ali_Key= "xxxx" export Ali_Secret= "xxxx" # apply for certificate acme.sh-- issue-- dns dns_ali-d k8s.your_domain.com# export certificate using mkdir certsacme.sh-- installcert-d k8s.your_domain.com\-- key-file ~ / certs/tls.key\-- fullchain-file ~ / certs/tls.crt

Delete the following from k8s-dashboard.yaml

# apiVersion: v1# kind: Secret# metadata:# labels:# k8s-app: kubernetes-dashboard# name: kubernetes-dashboard-certs# namespace: kubernetes-dashboard# type: Opaque

Create a certs first

Kubectl create ns kubernetes-dashboardkubectl create secret generic kubernetes-dashboard-certs-- from-file=$HOME/certs-n kubernetes-dashboard

Args of Deployment adds key

Args: #-auto-generate-certificates-namespace=kubernetes-dashboard-token-ttl=43200-tls-cert-file=tls.crt-tls-key-file=tls.key

Application file

Kubectl apply-f k8s-dashboard.yaml

The kubeconfig file is created as follows:

# create a dashboard administrative user kubectl create serviceaccount dashboard-admin-n kube-system# to bind the created dashboard user as the administrative user kubectl create clusterrolebinding dashboard-cluster-admin-- clusterrole=cluster-admin-- serviceaccount=kube-system:dashboard-admin# via kubectl get secrets-n kube-system | grep dashboard. Get your keyDASH_TOKEN=$ (kubectl get secrets-n kube-system dashboard-admin-token- your key-o jsonpath= {.data.token} | base64-d) # create the login file for kubeconfig # your_name is the user name of ubuntu Modify kubectl config set-cluster kubernets-- server=192.168.1.30:6443-- kubeconfig=/home/your_name/.dashboard-admin.confkubectl config set-credentials dashboard-admin-- token=$ {DASH_TOKEN}-- kubeconfig=/home/your_name/.dashboard-admin.confkubectl config set-context dashboard-admin@kubernetes-- cluster=kubernetes-- user=dashboard-admin-- kubeconfig=/home/your_name/.dashboard-admin.confkubectl config use-context dashboard-admin@kubernetes-- kubeconfig=/home/your_name/.dashboard-admin.conf as appropriate

Finally, copy the. dashboard-admin.conf to another machine, and use this file to log in

Install cpu. Memory Monitoring reference https://my.oschina.net/u/160697/blog/write/3186880

Thank you for reading! This is the end of the article on "how to install dashboard in kubernetes". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report