sealos4.3.5 Installation Manual (3) Management Interface

The previous article sealos4.3.5 Installation Manual (2) Adding Nodes explains how to add nodes. In this article we will look at how to add a Kanban board, which can be operated through an interface.

1. Officially recommended kubernetes-dashboard

First, add the officially recommended kubernetes-dashboard
Find the required version on k8s github

Download configuration file

wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Change the name so you can view the version

mv recommended.yaml recommended-v2.7.0.yaml

Modify configuration file
Find the corresponding part and add the configuration. By default, the Dashboard can only be accessed within the cluster, and users can access it outside the cluster.

........
Kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kubernetes-dashboard
spec:
  ports:
    - port: 443
      targetPort: 8443
  selector:
    k8s-app: kubernetes-dashboard
  type: NodePort #Add a line
........

Complete the modification and execute the file after confirming that it is correct.

kubectl apply -f recommended-v2.7.0.yaml

[root@k8s-master1 dashboard]# kubectl apply -f recommended-v2.7.0.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created

View dashboard status, by default under the kubernetes-dashboard namespace

kubectl get pods -n kubernetes-dashboard

[root@k8s-master1 dashboard]# kubectl get pods -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
dashboard-metrics-scraper-5cb4f4bb9c-szzs7 1/1 Running 0 5m40s
kubernetes-dashboard-6967859bff-zf4kc 1/1 Running 0 5m40s
# View the ip port and open it from the web page
kubectl get svc -n kubernetes-dashboard

[root@k8s-master1 dashboard]# kubectl get svc -n kubernetes-dashboard
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
dashboard-metrics-scraper ClusterIP 10.96.3.67 <none> 8000/TCP 8m20s
kubernetes-dashboard NodePort 10.96.3.139 <none> 443:32430/TCP 8m20s

https://master node IP + SVCPort
My master is 41, 42, 43. These three IPs can be used.

https://192.168.1.41:32430/
Access successful

Login via Token

Get token

kubectl -n kubernetes-dashboard create token kubernetes-dashboard


[root@k8s-master1 dashboard]# kubectl -n kubernetes-dashboard create token kubernetes-dashboard
eyJhbGciOiJSUzI1NiIsImtpZCI6InBiTjY4WHVXX09tNnUtVzAtanR3cW5KU0dIUjZPRGt6Uy11NFprYjFBdUUifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdX N0ZXIubG9jYWwiXSwiZXhwIjoxNjk3MjY0NjQ0LCJpYXQiOjE2OTcyNjEwNDQsImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZX Rlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsInVpZCI6ImE1N2I1ZmMzLTI2M jMtNDRiOC1hMTU0LTY5YjY1NzIyYjBmMCJ9fSwibmJmIjoxNjk3MjYxMDQ0LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZXJuZXRlcy1kYXNoYm9hcmQ6a3ViZXJuZXRlcy1kYXNoYm 9hcmQifQ.dZx_-hEHmu-lWJS58APmHP-KvMSAtsN_QciPGkCnpVKmrxcSyMwj3nx4v-gl-7O-2BB2qnIUUOIbMehHvJzWSmBNhIX40In5ceuh1FpHzrxSwMk4CTh_U1z8osq4T1-pT1bcqMuL4 tC-iBW-VKzVxEF0F2qTGejsPWDgNCskHOjH93CThPxucFgI7J3byFozfChg4QmkGgrbCF1vacSS_14KpUxp8k9TnVogq90ciyrbpBh7nAuLFZ206wt7xOcQMjaWEAS8u_shyuZCFQ5yP276JlUxuuevDU-hJ etzRciYKHY6sZTTEJmjLDHvfhgra5UZiz4RcmvLzJ3QX1ByeQ

Copy the output token and enter the management page

This ends the explanation of the kubernetes-dashboard management interface.

2. kuboard developed by Chinese people

Below we recommend a k8s interface management plug-in developed by Chinese people, which will be helpful to those who are learning k8s for the first time.

kuboard official website

First time learning in kuboard, recommended plug-in installation method
Install Kuboard v3 – built-in user library

First, I found a test machine and installed docker.
The docker version on this machine is no less than 19.03

Run the docker command and modify your corresponding IP

docker run -d --restart=unless-stopped --name=kuboard -p 80:80/tcp -p 10081:10081/tcp -e KUBOARD_ENDPOINT="http://192.168.1.38:80" -e KUBOARD_AGENT_SERVER_TCP_PORT="10081" -v /root/kuboard-data:/data eipwork/kuboard:v3

After the installation is complete, access kuboard in the browser
http://192.168.1.38/

Default login information
Username: admin
Password: Kuboard123

Add k8s cluster to kuboard

In the master node, execute the copied command

[root@k8s-master1 kuboard]# cat << EOF > kuboard-create-token.yaml
> ---
> apiVersion: v1
> kind: Namespace
> metadata:
> name: kuboard
>
> ---
> apiVersion: v1
> kind: ServiceAccount
> metadata:
> name: kuboard-admin
> namespace: kuboard
>
> ---
> apiVersion: rbac.authorization.k8s.io/v1
> kind: ClusterRoleBinding
> metadata:
> name: kuboard-admin-crb
> roleRef:
> apiGroup: rbac.authorization.k8s.io
> kind: ClusterRole
> name: cluster-admin
>subjects:
> - kind: ServiceAccount
> name: kuboard-admin
> namespace: kuboard
>
> ---
> apiVersion: v1
> kind: Secret
> type: kubernetes.io/service-account-token
> metadata:
> annotations:
> kubernetes.io/service-account.name: kuboard-admin
> name: kuboard-admin-token
> namespace: kuboard
> EOF
[root@k8s-master1 kuboard]#
[root@k8s-master1 kuboard]# kubectl apply -f kuboard-create-token.yaml
?Fill in the Token field in the kuboard interface:\033[0m"
echo -e "\033[31m$(kubectl -n kuboard get secret $(kubectl -n kuboard get secret kuboard-admin-token | grep kuboard-admin-token | awk '{print $1}') - o go-template='{<!-- -->{.data.token}}' | base64 -d)\033[0m"
namespace/kuboard created
serviceaccount/kuboard-admin created
clusterrolebinding.rbac.authorization.k8s.io/kuboard-admin-crb created
secret/kuboard-admin-token created
[root@k8s-master1 kuboard]# echo -e "\033[1;34m Fill the following line of red output into the Token field of the kuboard interface: \033[0m"
Fill the following line of red output into the Token field of the kuboard interface:
[root@k8s-master1 kuboard]# echo -e "\033[31m$(kubectl -n kuboard get secret $(kubectl -n kuboard get secret kuboard-admin-token | grep kuboard-admin-token | awk \ '{print $1}') -o go-template='{<!-- -->{.data.token}}' | base64 -d)\033[0m"
eyJhbGciOiJSUzI1NiIsImtpZCI6InBiTjY4WHVXX09tNnUtVzAtanR3cW5KU0dIUjZPRGt6Uy11NFprYjFBdUUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZX Rlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJvYXJkIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Imt1Ym9hcmQtYWRtaW4tdG9rZW4iLCJrdW Jlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoia3Vib2FyZC1hZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2N vdW50LnVpZCI6IjQ4MTMwNGQyLTRlZjgtNDVmYi05OGIyLTlhODdhYTY5NDYwOCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJvYXJkOmt1Ym9hcmQtYWRtaW4ifQ.PYC9l8yuScH-lkCAy C5lj4cLv506oDEJwe5V0jTmkFNj1ek5qQbDPnUvRw5GHGeSh6Kt_oTwImHbZFGdfh2oPq3qPJAVvULRycDcxkGAt15upNld2gjBeEbSEldpjUL06DFN6yADEzIBEKi0t3pIsRDB3klxNDPi4hYoK qpHRKoiCOrBcjoARt5pnSH1NPKdIFsnzO5uCFztsmv_v4U33nxdCVCN8ngA-urpU0xN5T0eOXqNX1jxa3W_MSOq1Qwtz0S09l2J119wBbjmQ1k-LYeEstNvTGgj3ZgiWRnnSKK0s9y-RA--j7rdwoLa6l8D vgmlgzZbt-bK81LvRGo17w

View apiService
I am running on the master node of 41, so I need to modify apiserver.cluster.local in the result to my corresponding IP
Finally, the url of my apiserver is https://192.168.1.41:6443

cat /etc/kubernetes/kubelet.conf | grep server
[root@k8s-master1 kuboard]# cat /etc/kubernetes/kubelet.conf | grep server
    server: https://apiserver.cluster.local:6443

Fill in the information related to importing k8s cluster

View added cluster information

Finish!

This concludes the installation and learning of k8s.

The picture below can increase bloggers’ motivation to share knowledge, let’s give it a try

Motivation for learning