Kubernetes部署dashboard

Kubernetes部署dashboard

Kubernetes集群安裝

鯤鵬arm64架構下安裝KubeSphere

linux安裝部署k8s(kubernetes)和解決遇到的坑

dashboard部署

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml# 開啟本機訪問代理 proxy代理只能本機訪問
$ kubectl proxykubectl proxy --address='0.0.0.0' --port=8001
kubectl proxy --address='0.0.0.0' --port=30099 --accept-hosts='^*$'

訪問
http://192.168.1.53:30099/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

在這里插入圖片描述

加了允許外部訪問,使用token 登錄無反應,跳過登錄進入后,有問題,看不了內容

kubectl -n kube-system describe $(kubectl -n kube-system get secret -n kube-system -o name | grep namespace) | grep token 獲取token

創建用戶

參考:
https://www.cnblogs.com/RainingNight/p/deploying-k8s-dashboard-ui.html

創建服務賬號, 首先創建一個叫admin-user的服務賬號,并放在kube-system名稱空間下
# admin-user.yaml
apiVersion: v1
kind: ServiceAccount
metadata:name: admin-usernamespace: kube-system執行kubectl create命令
kubectl create -f admin-user.yaml綁定角色, 默認情況下,kubeadm創建集群時已經創建了admin角色,我們直接綁定即可
# admin-user-role-binding.yaml
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:name: admin-user
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: cluster-admin
subjects:
- kind: ServiceAccountname: admin-usernamespace: kube-system執行kubectl create命令
kubectl create -f  admin-user-role-binding.yaml獲取Token, 現在我們需要找到新創建的用戶的Token,以便用來登錄dashboard
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

然后把Token復制到登錄界面的Token輸入框中,登入后顯示如下

在這里插入圖片描述

查看pod

kubectl get pods --namespace kube-system
get pods -n kube-system | grep -v Running
kubectl get services --namespace kube-system

在這里插入圖片描述
在這里插入圖片描述

kubeadm 部署的k8s集群 Dashboard遇到的問題

參考:
https://www.jianshu.com/p/f9a2bd82e368

使得pod不會分配到到master節點上
kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yamlwget https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yamlcat kubernetes-dashboard.yaml 
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.# ------------------- Dashboard Secret ------------------- #apiVersion: v1
kind: Secret
metadata:labels:k8s-app: kubernetes-dashboardname: kubernetes-dashboard-certsnamespace: kube-system
type: Opaque---
# ------------------- Dashboard Service Account ------------------- #apiVersion: v1
kind: ServiceAccount
metadata:labels:k8s-app: kubernetes-dashboardname: kubernetes-dashboardnamespace: kube-system---
# ------------------- Dashboard Role & Role Binding ------------------- #kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: kubernetes-dashboard-minimalnamespace: kube-system
rules:# Allow Dashboard to create 'kubernetes-dashboard-key-holder' secret.
- apiGroups: [""]resources: ["secrets"]verbs: ["create"]# Allow Dashboard to create 'kubernetes-dashboard-settings' config map.
- apiGroups: [""]resources: ["configmaps"]verbs: ["create"]# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
- apiGroups: [""]resources: ["secrets"]resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs"]verbs: ["get", "update", "delete"]# Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
- apiGroups: [""]resources: ["configmaps"]resourceNames: ["kubernetes-dashboard-settings"]verbs: ["get", "update"]# Allow Dashboard to get metrics from heapster.
- apiGroups: [""]resources: ["services"]resourceNames: ["heapster"]verbs: ["proxy"]
- apiGroups: [""]resources: ["services/proxy"]resourceNames: ["heapster", "http:heapster:", "https:heapster:"]verbs: ["get"]---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:name: kubernetes-dashboard-minimalnamespace: kube-system
roleRef:apiGroup: rbac.authorization.k8s.iokind: Rolename: kubernetes-dashboard-minimal
subjects:
- kind: ServiceAccountname: kubernetes-dashboardnamespace: kube-system---
# ------------------- Dashboard Deployment ------------------- #kind: Deployment
apiVersion: apps/v1beta2
metadata:labels:k8s-app: kubernetes-dashboardname: kubernetes-dashboardnamespace: kube-system
spec:replicas: 1revisionHistoryLimit: 10selector:matchLabels:k8s-app: kubernetes-dashboardtemplate:metadata:labels:k8s-app: kubernetes-dashboardspec:nodeName: k8s-mastercontainers:- name: kubernetes-dashboardimage: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0ports:- containerPort: 8443protocol: TCPargs:- --auto-generate-certificates# Uncomment the following line to manually specify Kubernetes API server Host# If not specified, Dashboard will attempt to auto discover the API server and connect# to it. Uncomment only if the default does not work.# - --apiserver-host=http://my-address:portvolumeMounts:- name: kubernetes-dashboard-certsmountPath: /certs# Create on-disk volume to store exec logs- mountPath: /tmpname: tmp-volumelivenessProbe:httpGet:scheme: HTTPSpath: /port: 8443initialDelaySeconds: 30timeoutSeconds: 30volumes:- name: kubernetes-dashboard-certssecret:secretName: kubernetes-dashboard-certs- name: tmp-volumeemptyDir: {}serviceAccountName: kubernetes-dashboard# Comment the following tolerations if Dashboard must not be deployed on master# tolerations:# - key: node-role.kubernetes.io/master#   effect: NoSchedule---
# ------------------- Dashboard Service ------------------- #kind: Service
apiVersion: v1
metadata:labels:k8s-app: kubernetes-dashboardname: kubernetes-dashboardnamespace: kube-system
spec:type: NodePortports:- port: 443nodePort: 30001targetPort: 8443selector:k8s-app: kubernetes-dashboard
執行命令
kubectl delete -f kubernetes-dashboard.yaml  kubectl create -f kubernetes-dashboard.yaml 

配置 type: NodePort 讓外部訪問
https://192.168.1.53:30001/#!/namespace?namespace=default

使用token登錄
kubectl -n kube-system describe $(kubectl -n kube-system get secret -n kube-system -o name | grep namespace) | grep token

參考鏈接:
https://www.cnblogs.com/RainingNight/p/deploying-k8s-dashboard-ui.html
https://www.jianshu.com/p/f9a2bd82e368

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/15607.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/15607.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/15607.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

STM32學習和實踐筆記(30):窗口看門狗(WWDG)實驗

1.WWDG介紹 1.1 WWDG簡介 上一章我們已經介紹了IWDG,知道它的工作原理就是一個12位遞減計數器不斷遞減計數,當減到0之前還未進行喂狗的話,產生一個MCU復位。 窗口看門狗WWDG其實和獨立看門狗類似,它是一個7位遞減計數器不斷的往…

Vue3在Element UI 表格中自定義時間格式化顯示

Vue3在Element UI 表格中自定義時間格式化顯示 一、前言1、準備工作2、實現步驟1. 引入 Element UI 組件2. 自定義時間格式化函數3. 格式化日期邏輯 3、完整示例4、結論 一、前言 在開發 Web 應用程序時,常常需要在表格中展示時間數據。Element UI 是一個流行的 Vu…

【Python】 如何在Python中創建GUID UUID

基本原理 GUID(全局唯一標識符)和UUID(通用唯一標識符)都是用來在分布式系統中唯一標識信息的。在Python中,我們可以使用內置的uuid模塊來生成這些唯一標識符。 UUID有幾種不同的版本,每種版本都有其特定…

軟考-必須要背的內容

一、設計模式 1、創建型 抽象工廠:提供一個接口,創建一系列的相關相互依賴的對象,無需指定具體的類; eg:系統軟件,支持多種數據庫 生成器:將一個復雜類的表示與構造相分離,使得相…

Scrapy順序執行多個爬蟲

Scrapy順序執行多個爬蟲 有兩種方式: 第一種:bat方式運行 新建bat文件 cd C:\python_web\spiders\tiktokSelenium & C: & scrapy crawl spider1 & scrapy crawl spider2 & scrapy crawl spider3 & scrapy crawl spider4 第二種&a…

IOS開發者證書快捷申請

App Uploader 在進行iOS應用開發中,可以借助appuploader輔助工具進行證書制作、上傳和安裝測試等操作。首先,您需要訪問官方網站獲取最新版本的appuploader。最新版本已經優化了與Apple賬號的登錄流程,無需支付688元,并提供了Windows版和Mac版供用戶選擇。下載完成后,解壓…

USART串口通信(stm32)

一、串口通信 通信的目的:將一個設備的數據傳送到另一個設備,擴展硬件系統 通信協議:制定通信的規則,通信雙方按照協議規則進行數據收發 STM32F103C8T6 USART資源: USART1、 USART2、 USART3 自帶波特率發生器&…

方正暢享全媒體新聞采編系統 binary.do SQL注入漏洞復現

0x01 產品簡介 方正暢享全媒體新聞生產系統是以內容資產為核心的智能化融合媒體業務平臺,融合了報、網、端、微、自媒體分發平臺等全渠道內容。該平臺由協調指揮調度、數據資源聚合、融合生產、全渠道發布、智能傳播分析、融合考核等多個平臺組成,貫穿新聞生產策、采、編、發…

【華三包過】2024年/華三H3C/云計算GB0-713

H3CNE-cloud-云計算-713 想轉行 想繼續深入 題庫覆蓋百分百,題庫有新版106道新版113道舊版88道 H3C認證云計算工程師(H3C Certified Network Engineer for Cloud,簡稱H3CNE-Cloud) 認證定位于全面掌握虛擬化技術原理及相關產品/…

半導體行業AI機器視覺的應用探討(3)-效益如何評估

作為半導體廠的IT經理,評估AI機器視覺帶來的經濟收益和管理收益是一個多維度的過程,需要綜合考慮成本節約、效率提升、質量改進等多個方面。以下是一個具體的評估方案: 1. 成本效益分析(CBA) **步驟**: - **初始投資成本**:列出所有與AI機器視覺系統相關的初始投資,包…

c++二進制輸出

輸入一個數&#xff0c;輸出n個數&#xff0c;數可以是0或1&#xff1b;輸入&#xff1a;4輸出&#xff1a;0010&#xff1b;提示&#xff1a;本題要用到rand(),srand(time(0));代碼如下&#xff1a;#include<bits/stdc.h> #include<windows.h> using namespace s…

MySQL的數據庫和表

查看數據庫 命令行的方式&#xff1a; cd /mysql/bin mysql.exe -uroot -p IP&#xff08;不是連接自己&#xff09; 端口&#xff08;不是3306&#xff09; show databases; 直接使用圖形化界面點擊&#xff1a; 查看庫里的表 使用命令行查看&#xff1a; 進入mysql數據庫 u…

JavaFX學習教程二

一、JavaFX 體系結構 JavaFX 場景圖(Scene Graph)是構建 JavaFX 應用程序的起點&#xff0c;一種樹狀數據結構&#xff0c;用于排列&#xff08;和分組&#xff09;圖形對象&#xff0c;以便于邏輯表示。 stage:舞臺&#xff0c;操作系統窗口的 JavaFX 表示&#xff0c;是所有…

Nodejs+Socket.io+Web端完成聊天

前言 源碼獲取:nodeexpresssocket.ioweb: 聊天demo (gitee.com) 目錄結構 后端依賴 啟動方式 前端是html正常啟動 后端是node app.js 后端app.js核心代碼 const express require(express) const app express() var http require(http).Server(app) var io require(so…

掌握C++回調:按值捕獲、按引用捕獲與弱引用

文章目錄 一、按引用捕獲和按值捕獲1.1 原理1.2 案例 二、弱引用2.1 原理2.2 案例一2.3 案例二&#xff1a;使用base庫的弱引用 三、總結 在C回調中&#xff0c;當使用Lambda表達式捕獲外部變量時&#xff0c;有兩種捕獲方式&#xff1a;按值捕獲和按引用捕獲。 一、按引用捕獲…

Matlab自學筆記三十:元胞數組的修改、添加、刪除和連接

1.說明 元胞數組的子數組或元素也是元胞型的&#xff0c;其元素內容&#xff08;值&#xff09;是本身類型&#xff0c;因此&#xff0c;在添、刪、改和連接處理時&#xff0c;必須明確每個元素的值的類型和大小&#xff0c;否則&#xff0c;編程報錯是不可避免的了。看本文前…

Python 點云裁剪

點云裁剪 一、介紹1.1 概念1.2 函數講解二、代碼示例2.1 代碼實現2.2 代碼講解三、結果示例一、介紹 1.1 概念 點云裁剪 :根據待裁剪對象的多邊形體積(json文件)實現點云的裁剪。 1.2 函數講解 下面代碼示例中主要用到了兩個函數。 讀取待裁剪對象的多邊形體積信息(json文…

淺談C++函數

目錄 一、函數的概念二、調用函數的兩個前提三、函數傳參的三種形式四、函數返回類型 一、函數的概念 函數是C程序的基本模塊&#xff0c;通常一個C程序由一個或多個函數組成。函數可以完成用戶指定的任務&#xff0c;一般分為庫函數和用戶自定義的函數。函數由函數頭和函數體…

先進制造aps專題六 aps軟件開發最大的難點,設備甘特圖開發

aps軟件開發最大的難點&#xff0c;設備甘特圖開發 一般認為&#xff0c;aps軟開發中&#xff0c;算法是難的&#xff0c;排程算法難&#xff0c;優化算法更難&#xff0c;但其實最大的難點是設備甘特圖開發 aps軟件設備甘特圖開發的幾個難點如下 1 和項目甘特圖一行顯示一個…

02. Flink 快速上手

02. Flink 快速上手 1、創建項目導入依賴 pom文件&#xff1a; <properties><flink.version>1.17.0</flink.version> </properties><dependency><groupId>org.apache.flink</groupId><artifactId>flink-streaming-java<…