k8s上安裝KubeSphere

安裝KubeSphere

  • 前置環境
    • 安裝nfs-server文件系統
      • 配置nfs-client
      • 配置默認存儲
      • 創建了一個存儲類
      • metrics-server集群指標監控組件
    • 安裝KubeSphere
      • 執行安裝
      • 查看安裝進度

前置環境

  • 下載配置我都是以CentOS 7.9 安裝 k8s(詳細教程)文章的服務器作為示例,請自行修改為自己的服務器ip。
  • 默認你懂k8s基本命令

安裝nfs-server文件系統

# 在每個機器。
yum install -y nfs-utils# 在master 執行以下命令 
echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports# 執行以下命令,啟動 nfs 服務;創建共享目錄
mkdir -p /nfs/data# 在master執行
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server# 使配置生效
exportfs -r#檢查配置是否生效
exportfs

配置nfs-client

# 在兩個子節點執行 把ip改為自己的主節點
showmount -e 192.168.0.71
  • 這樣就是成功了
    在這里插入圖片描述
#創建文件夾
mkdir -p /nfs/data
#綁定文件夾
mount -t nfs 192.168.0.71:/nfs/data /nfs/data

配置默認存儲

使用vi sc.yaml 創建一個文件,然后把內容復制進去,執行kubectl apply -f sc.yaml

創建了一個存儲類

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:name: nfs-storageannotations:storageclass.kubernetes.io/is-default-class: "true"
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner
parameters:archiveOnDelete: "true"  ## 刪除pv的時候,pv的內容是否要備份---
apiVersion: apps/v1
kind: Deployment
metadata:name: nfs-client-provisionerlabels:app: nfs-client-provisioner# replace with namespace where provisioner is deployednamespace: default
spec:replicas: 1strategy:type: Recreateselector:matchLabels:app: nfs-client-provisionertemplate:metadata:labels:app: nfs-client-provisionerspec:serviceAccountName: nfs-client-provisionercontainers:- name: nfs-client-provisionerimage: registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/nfs-subdir-external-provisioner:v4.0.2# resources:#    limits:#      cpu: 10m#    requests:#      cpu: 10mvolumeMounts:- name: nfs-client-rootmountPath: /persistentvolumesenv:- name: PROVISIONER_NAMEvalue: k8s-sigs.io/nfs-subdir-external-provisioner- name: NFS_SERVERvalue: 172.31.0.4 ## 指定自己nfs服務器地址- name: NFS_PATH  value: /nfs/data  ## nfs服務器共享的目錄volumes:- name: nfs-client-rootnfs:server: 192.168.0.71path: /nfs/data
---
apiVersion: v1
kind: ServiceAccount
metadata:name: nfs-client-provisioner# replace with namespace where provisioner is deployednamespace: default
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: nfs-client-provisioner-runner
rules:- apiGroups: [""]resources: ["nodes"]verbs: ["get", "list", "watch"]- apiGroups: [""]resources: ["persistentvolumes"]verbs: ["get", "list", "watch", "create", "delete"]- apiGroups: [""]resources: ["persistentvolumeclaims"]verbs: ["get", "list", "watch", "update"]- apiGroups: ["storage.k8s.io"]resources: ["storageclasses"]verbs: ["get", "list", "watch"]- apiGroups: [""]resources: ["events"]verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: run-nfs-client-provisioner
subjects:- kind: ServiceAccountname: nfs-client-provisioner# replace with namespace where provisioner is deployednamespace: default
roleRef:kind: ClusterRolename: nfs-client-provisioner-runnerapiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: leader-locking-nfs-client-provisioner# replace with namespace where provisioner is deployednamespace: default
rules:- apiGroups: [""]resources: ["endpoints"]verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:name: leader-locking-nfs-client-provisioner# replace with namespace where provisioner is deployednamespace: default
subjects:- kind: ServiceAccountname: nfs-client-provisioner# replace with namespace where provisioner is deployednamespace: default
roleRef:kind: Rolename: leader-locking-nfs-client-provisionerapiGroup: rbac.authorization.k8s.io

查看運行狀況kubectl describe pod nfs-client-provisioner-xxx
kubectl get sc
在這里插入圖片描述

metrics-server集群指標監控組件

使用vi metrics-server.yaml 創建一個文件,然后把內容復制進去,執行kubectl apply -f metrics-server.yaml

apiVersion: v1
kind: ServiceAccount
metadata:labels:k8s-app: metrics-servername: metrics-servernamespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:labels:k8s-app: metrics-serverrbac.authorization.k8s.io/aggregate-to-admin: "true"rbac.authorization.k8s.io/aggregate-to-edit: "true"rbac.authorization.k8s.io/aggregate-to-view: "true"name: system:aggregated-metrics-reader
rules:
- apiGroups:- metrics.k8s.ioresources:- pods- nodesverbs:- get- list- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:labels:k8s-app: metrics-servername: system:metrics-server
rules:
- apiGroups:- ""resources:- pods- nodes- nodes/stats- namespaces- configmapsverbs:- get- list- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:labels:k8s-app: metrics-servername: metrics-server-auth-readernamespace: kube-system
roleRef:apiGroup: rbac.authorization.k8s.iokind: Rolename: extension-apiserver-authentication-reader
subjects:
- kind: ServiceAccountname: metrics-servernamespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:labels:k8s-app: metrics-servername: metrics-server:system:auth-delegator
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: system:auth-delegator
subjects:
- kind: ServiceAccountname: metrics-servernamespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:labels:k8s-app: metrics-servername: system:metrics-server
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: system:metrics-server
subjects:
- kind: ServiceAccountname: metrics-servernamespace: kube-system
---
apiVersion: v1
kind: Service
metadata:labels:k8s-app: metrics-servername: metrics-servernamespace: kube-system
spec:ports:- name: httpsport: 443protocol: TCPtargetPort: httpsselector:k8s-app: metrics-server
---
apiVersion: apps/v1
kind: Deployment
metadata:labels:k8s-app: metrics-servername: metrics-servernamespace: kube-system
spec:selector:matchLabels:k8s-app: metrics-serverstrategy:rollingUpdate:maxUnavailable: 0template:metadata:labels:k8s-app: metrics-serverspec:containers:- args:- --cert-dir=/tmp- --kubelet-insecure-tls- --secure-port=4443- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname- --kubelet-use-node-status-portimage: registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/metrics-server:v0.4.3imagePullPolicy: IfNotPresentlivenessProbe:failureThreshold: 3httpGet:path: /livezport: httpsscheme: HTTPSperiodSeconds: 10name: metrics-serverports:- containerPort: 4443name: httpsprotocol: TCPreadinessProbe:failureThreshold: 3httpGet:path: /readyzport: httpsscheme: HTTPSperiodSeconds: 10securityContext:readOnlyRootFilesystem: truerunAsNonRoot: truerunAsUser: 1000volumeMounts:- mountPath: /tmpname: tmp-dirnodeSelector:kubernetes.io/os: linuxpriorityClassName: system-cluster-criticalserviceAccountName: metrics-servervolumes:- emptyDir: {}name: tmp-dir
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:labels:k8s-app: metrics-servername: v1beta1.metrics.k8s.io
spec:group: metrics.k8s.iogroupPriorityMinimum: 100insecureSkipTLSVerify: trueservice:name: metrics-servernamespace: kube-systemversion: v1beta1versionPriority: 100

使用命令查看一下運行狀態 kubectl get pods -A
在這里插入圖片描述

安裝KubeSphere

KubeSphere官網:https://kubesphere.com.cn/

下載核心文件

wget https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/kubesphere-installer.yamlwget https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/cluster-configuration.yaml

執行安裝

kubectl apply -f kubesphere-installer.yamlkubectl apply -f cluster-configuration.yaml

查看安裝進度

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
  • 訪問任意機器的 30880端口
  • 賬號 : admin
  • 密碼 : P@88w0rd

解決etcd監控證書找不到問題

kubectl -n kubesphere-monitoring-system create secret generic kube-etcd-client-certs  --from-file=etcd-client-ca.crt=/etc/kubernetes/pki/etcd/ca.crt  --from-file=etcd-client.crt=/etc/kubernetes/pki/apiserver-etcd-client.crt  --from-file=etcd-client.key=/etc/kubernetes/pki/apiserver-etcd-client.key

到這里就全部安裝完成了

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

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

相關文章

2024年軟考科目怎么選?(選科指引)

新手在準備報考軟考時,都會遇到這樣的一個問題——科目這么多,我適合考什么?要想知道自己適合報什么科目,就需要了解每個科目是什么,考什么等一系列的問題。今天給大家分享一下。 軟考包含什么科目? 軟考…

facebook廣告相比谷歌廣告的優勢

Facebook廣告相比谷歌廣告的優勢主要體現在以下方面: 用戶數據豐富:Facebook擁有龐大的用戶數據,包括人口、興趣、行為等多個維度,這些數據可以幫助廣告主更準確地定位到目標受眾。相比之下,谷歌廣告的用戶數據相對較…

android快速網絡請求之android-networking

今天介紹一個知道的人不多的庫,寫個簡單的頁面什么的。用起來很爽?如果你疑惑那么多開源的網絡庫為啥不用? 因為這個簡單方便。拿來就用。經過這幾天的實踐。確實可以。推薦一下 如果你需要 GITHUB 首先。引入依賴 implementation com.ami…

MySQL 數據遷移要點

目錄 1. 相同版本的遷移 2. 不用版本的遷移 3. 不同數據庫的遷移 數據庫遷移就是把數據從一個系統移動到另一個系統上,遷移過程其實就是在源數據庫備份和目標數據庫恢復的過程組合。遷移的原因是多種多樣的,比如: 需要安裝新的數據庫服務…

elasticsearch中LessThen遇到的坑

開發中&#xff0c;使用到LessThen-小于某個參數的邏輯查詢&#xff0c;如下&#xff1a; /// <summary> /// 查詢狀態已發布&#xff08;狀態小于2&#xff09;的政策要聞分頁 /// </summary> /// <param name"input"></param> /// <re…

使用OkHttp上傳本地圖片及參數

下面以一個例子來講解在項目中如何使用OKHttp來對本地圖片做個最簡單的上傳功能&#xff0c;基本上無封裝&#xff0c;只需要簡單調用便可&#xff08;對于OKHttp的引入不再單獨做介紹&#xff09;。 1&#xff1a;構建上傳圖片附帶的參數&#xff08;params&#xff09; Map…

2.vue學習筆記(目錄結構+模板語法+屬性綁定)

1.目錄結構 1.vscode ——VSCode工具的配置文件夾 2.node_modules ——Vue項目的運行依賴文件夾 3.public ——資源文件夾&#xff08;瀏覽器圖標&#xff09; 4.src ——源碼文件夾 5..gitgnore ——git忽略文件 6.index.html ——如果html文件 7.package.json —…

基于SpringBoot+Vue學生成績管理系統前后端分離(源碼+數據庫)

一、項目簡介 本項目是一套基于SpringBootVue學生成績管理系統&#xff0c;主要針對計算機相關專業的正在做bishe的學生和需要項目實戰練習的Java學習者。 包含&#xff1a;項目源碼、數據庫腳本等&#xff0c;該項目可以直接作為bishe使用。 項目都經過嚴格調試&#xff0c;確…

ElasticSearch中的分析器是什么?

在Elasticsearch中&#xff0c;分析器&#xff08;Analyzer&#xff09;是一個用于文本分析的重要組件。它定義了如何將文本分解成單詞和子詞&#xff0c;這對于索引和搜索是非常重要的。 在Elasticsearch中&#xff0c;分析器定義了如何將文本轉換為可以被索引和搜索的形式。…

虛幻學習筆記10—C++函數與藍圖的通信

一、前言 除了上一章C變量與藍圖通信講的變量能與藍圖通信外&#xff0c;還有函數和枚舉也可以和藍圖通信。函數的關鍵字為”UFUNCTION“、枚舉的關鍵字為”UENUM“。 二、實現 2.1、BlueprintCallable藍圖中調用 該函數時帶執行的&#xff0c;帶入如下。編譯成功后在藍圖中輸…

macOS 獲取文件夾大小

macOS 獲取文件夾大小 獲取文件夾大小的擴展如下&#xff1a; extension URL {var fileSize: Int? { // in bytesdo {let val try self.resourceValues(forKeys: [.totalFileAllocatedSizeKey, .fileAllocatedSizeKey])return val.totalFileAllocatedSize ?? val.fileAll…

來自Sui的溫馨建議:保護您的Web3私鑰

當您安裝一個錢包并創建Sui賬戶時&#xff0c;錢包包含一個公鑰和一個私鑰。保護好私鑰的安全非常重要&#xff0c;從而可以保護您的Sui資產&#xff0c;包括錢包中的任何tokens。 公鑰加密技術是幾十年前開發的&#xff0c;是當今互聯網上大多數安全交易的基礎&#xff0c;包…

Navicat Premium 16 for Mac/Windows:高效的數據庫開發工具

Navicat Premium 16是一款功能強大的數據庫開發工具&#xff0c;為開發人員提供了全面的工具和功能&#xff0c;幫助他們更高效地進行數據庫開發和管理。不論是初學者還是專業開發人員&#xff0c;Navicat Premium 16都能滿足他們的需求&#xff0c;并提供直觀、易用的界面。 …

【深度學習】AlexNet網絡實現貓狗分類

【深度學習】AlexNet網絡實現貓狗分類 AlexNet簡介 AlexNet是一種卷積神經網絡&#xff08;Convolutional Neural Network&#xff0c;CNN&#xff09;模型&#xff0c;它在2012年的ImageNet圖像分類挑戰賽中取得了重大突破&#xff0c;引發了深度學習在計算機視覺領域的熱潮…

為“異常”努力是值得的

異常是OO語言處理錯誤的方式,在C中&#xff0c;鼓勵使用異常。侯捷再書中談起異常&#xff0c;“十年前撰寫“未將異常考慮在內的”函數是為一種美好實踐&#xff0c;而今我們致力于寫出“異常安全碼”。”可見異常安全的重要。 說起異常安全&#xff0c;首先就要是異常的出現…

Leetcode—213.打家劫舍II【中等】

2023每日刷題&#xff08;五十二&#xff09; Leetcode—213.打家劫舍II 算法思路 實現代碼 class Solution { public:// 左閉右開int rob1(vector<int>& nums, int start, int end) {int n nums.size();int f0 0, f1 0, new_f 0;for(int i start; i < end…

pytorch學習入門之 Variable(變量)

Variable(變量) autograd.Variable 是包的核心類. 它包裝了張量, 并且支持幾乎所有的操作. 一旦你完成了你的計算, 你就可以調用 .backward() 方法, 然后所有的梯度計算會自動進行. 你還可以通過 .data 屬性來訪問原始的張量, 而關于該 variable(變量)的梯度會被累計到 .…

初識 OpenCV

初識 OpenCV 簡介 OpenCV&#xff08;Open Source Computer Vision Library&#xff09;是一個涵蓋了數百種計算機視覺算法的開源算法庫。 OpenCV 具有模塊化結構&#xff0c;這意味著該軟件包包含多個共享或靜態庫。其中包含以下模塊&#xff1a; Core functionality (core…

機器學習硬件十年:性能變遷與趨勢

本文分析了機器學習硬件性能的最新趨勢&#xff0c;重點關注不同GPU和加速器的計算性能、內存、互連帶寬、性價比和能效等指標。這篇分析旨在提供關于ML硬件能力及其瓶頸的全面視圖。本文作者來自調研機構Epoch&#xff0c;致力于研究AI發展軌跡與治理的關鍵問題和趨勢。 &…

【送書活動四期】被GitHub 要求強制開啟 2FA 雙重身份驗證,我該怎么辦?

記得是因為fork了OpenZeppelin/openzeppelin-contracts的項目&#xff0c;之后就被GitHub 要求強制開啟 2FA 雙重身份驗證了&#xff0c;一拖再拖&#xff0c;再過幾天帳戶操作將受到限制了&#xff0c;只能去搞一下了 目錄 2FA是什么為什么要開啟 2FA 驗證GitHub 欲在整個平臺…