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 deploy Dashboard2 in Kubernetes1.17.0

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

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "how to deploy Dashboard2 in Kubernetes1.17.0". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to deploy Dashboard2 in Kubernetes1.17.0.

Dashboard is the basic Web management tool of Kubernetes. The Dashboard 1.x series can only be used with versions prior to Kubernetes 1.16. Starting from Kubernetes 1.16, you need to use Dashboard 2, and its deployment has changed greatly.

1. Install the service

If you have not already installed the CNI driver, you can use the following command to install a flannel virtual network driver.

Obtain the image first:

Docker pull quay.io/coreos/flannel:v0.11.0-amd64

Then, install:

Kubectl apply-f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml

Pull the images of Dashboard:

Docker pull kubernetesui/metrics-scraper:v1.0.1docker pull kubernetesui/dashboard:v2.0.0-beta8

Note that there are several changes:

Now there are two mirrors, but there used to be only one.

The namespace changed from kube-system to kubernetes-dashboard.

The mode of authorization has changed, and the specific methods will be described below.

2. Access permission settings

It includes the steps of creating a service account, setting the role of the service account, obtaining token, and so on.

2.1 create a service access account

Create a Service Account, name it admin-user, and put it in namespace kubernetes-dashboard.

ApiVersion: v1kind: ServiceAccountmetadata: name: admin-user namespace: kubernetes-dashboard

Save the above as a file dashboard-adminuser.yaml.

2.2 create ClusterRoleBinding

In most cases, after deploying the cluster using kops or kubeadm, ClusterRole admin-Role already exists in the cluster and we can use it by creating a ClusterRoleBinding to our ServiceAccount.

Note: apiVersion of ClusterRoleBinding resources may vary from version to version of Kubernetes. Before Kubernetes v1.8, apiVersion was rbac.authorization.k8s.io/v1beta1.

ApiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata: name: admin-userroleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-adminsubjects:- kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard

Save the above contents to the file dashboard-adminrole.yaml.

2.3 Bearer Token

First, apply the two files above. As follows:

Kubectl apply-f dashboard-adminuser.yamlkubectl apply-f dashboard-adminrole.yaml

Find token to log in to Dashboard's Web interface. Execute the following command:

Kubectl-n kubernetes-dashboard describe secret $(kubectl-n kubernetes-dashboard get secret | grep admin-user | awk'{print $1}')

Copy the token content and use it in the WebUI below.

3. Access method

You need to expose Dashboard services for client access, including running agents and using NodePort methods. You can also use Ingress and other methods. Not described here, you can refer to:

Create a LoadBalancer service for a private Kubernetes cluster

Kubernetes dashboard provides HTTPS access through Ingress

3.1 Agent access mode

Run the agent service:

$kubectl proxy

Then open the following connection:

Http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/.

Select token mode to log in on the page, and then fill in the token copied in the above steps.

3.2 NodePort mode

Use kubectl get svc/dashboardxxxxx-n kubernetes-dashboard to get the service ID of dashboard.

Use kubectl edit svc/dashboardxxxxx-n kubernetes-dashboard to edit the parameters of the service, change the network type to NodePort, and increase port 30800.

Then open http://localhost:30800 to access it.

Select token mode to log in on the page, and then fill in the token copied in the above steps.

At this point, I believe you have a deeper understanding of "how to deploy Dashboard2 in Kubernetes1.17.0". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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