18video性欧美19sex,欧美高清videosddfsexhd,性少妇videosexfreexxx片中国,激情五月激情综合五月看花,亚洲人成网77777色在线播放

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

請問如何使用Helm在K8s上集成Prometheus呢?

馬哥Linux運維 ? 來源:51CTO ? 2024-01-10 17:24 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

開始使用 Helm 和 Helm Chart

ArtifactHub 為 Helm Chart 提供了公共和私有資源庫。我們將使用這些 Helm Chart 來設(shè)置 Kubernetes 集群中的 pod 和服務(wù)。

Helm 社區(qū)為各種 Kubernetes 應(yīng)用程序創(chuàng)建、管理和維護 Helm Chart,這些資源會時常更新。Helm Chart 可重復(fù)使用,安裝簡單。想要使用 Helm 在 Kubernetes 上集成 Prometheus ,讓我們從安裝 Helm 開始。

安裝 Helm

安裝 Helm 之前,必須使用以下命令啟動 Minikube Kubernetes:

minikube start --driver=docker

下圖顯示 Minikube 正在運行。Kubectl 工具現(xiàn)已配置為使用 Minikube。

197e5684-af98-11ee-8b88-92fbcf53809c.jpg

接下來,使用以下命令(根據(jù)你使用的操作系統(tǒng)使用對應(yīng)的命令)安裝 Helm:

Linux 上安裝 Helm

sudo apt-get install helm

在 Windows 上安裝 Helm

choco install Kubernetes-helm

在 macOS 系統(tǒng)上安裝 Helm

brew install helm

提示:如果遇到問題,可以查看 Helm 官方文檔指南 https://helm.sh/docs/intro/install/。

下圖顯示了 Helm 在 Windows 機器上的安裝情況:

198aa0ce-af98-11ee-8b88-92fbcf53809c.jpg

Helm 命令

要獲取所有 Helm 命令,請運行此命令:

helm

命令輸出結(jié)果:

The Kubernetes package manager


Common actions for Helm:


- helm search:    search for charts
- helm pull:      download a chart to your local directory to view
- helm install:   upload the chart to Kubernetes
- helm list:      list releases of charts


Usage:
  helm [command]


Available Commands:
  completion  generate autocompletion scripts for the specified shell
  create      create a new chart with the given name
  dependency  manage a chart's dependencies
  env         helm client environment information
  get         download extended information of a named release
  help        Help about any command
  history     fetch release history
  install     install a chart
  lint        examine a chart for possible issues
  list        list releases
  package     package a chart directory into a chart archive
  plugin      install, list, or uninstall Helm plugins
  pull        download a chart from a repository and (optionally) unpack it in local directory
  push        push a chart to remote
  registry    login to or logout from a registry
  repo        add, list, remove, update, and index chart repositories
  rollback    roll back a release to a previous revision
  search      search for a keyword in charts
  show        show information of a chart
  status      display the status of the named release
  template    locally render templates
  test        run tests for a release
  uninstall   uninstall a release
  upgrade     upgrade a release
  verify      verify that a chart at the given path has been signed and is valid
  version     print the client version information


Use "helm [command] --help" for more information about a command.

最常用的 Helm 命令有

helm search:在 ArtifactHub 資源庫中搜索 Helm Chart。

helm pull:從 ArtifactHub 資源庫中提取并下載 Helm Chart。

helm install:上傳 Helm Chart 并將其部署到 Kubernetes 集群。

helm list:列出 Kubernetes 集群中部署的所有 Helm Chart。

Prometheus Helm Charts

首先,我們將搜索 Prometheus Helm Charts。要搜索 Prometheus Helm,請運行以下命令:

helm search hub prometheus

該命令列出以下 Prometheus Helm Chart:

URL                                                       CHART VERSION         APP VERSION                                           DESCRIPTION
https://artifacthub.io/packages/helm/prometheus...        25.1.0                v2.47.0                                               Prometheus is a monitoring system and time seri...
https://artifacthub.io/packages/helm/truecharts...        13.0.7                2.47.1                                                kube-prometheus-stack collects Kubernetes manif...
https://artifacthub.io/packages/helm/saurabh6-p...        0.2.0                 1.1                                                   This is a Helm Chart for Prometheus Setup.
https://artifacthub.io/packages/helm/prometheus...        13.0.0                2.22.1                                                Prometheus is a monitoring system and time seri...
https://artifacthub.io/packages/helm/wenerme/pr...        25.1.0                v2.47.0                                               Prometheus is a monitoring system and time seri...
https://artifacthub.io/packages/helm/wener/prom...        25.1.0                v2.47.0                                               Prometheus is a monitoring system and time seri...
https://artifacthub.io/packages/helm/romanow-he...        1.3.5                 2.40.0                                                Prometheus collects and stores its metrics as t...
https://artifacthub.io/packages/helm/mach1el-ch...        1.0.1                 v2.47.0                                               Prometheus Helm chart for Kubernetes
https://artifacthub.io/packages/helm/cloudposse...        0.2.1                                                                       Prometheus instance created by the CoreOS Prome...

您還可以前往 ArtifactHub 存儲庫( https://artifacthub.io/)并搜索官方 Prometheus Helm Chart,如下圖所示:

19a1cbb4-af98-11ee-8b88-92fbcf53809c.jpg

列表中的第一個是官方的 Prometheus Helm Chart。要獲取此 Helm Chart,請運行以下命令:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

輸出結(jié)果:

"prometheus-community" has been added to your repositories
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "grafana" chart repository
...Successfully got an update from the "prometheus-community" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ?Happy Helming!?

現(xiàn)在,我們已經(jīng)下載好最新版本的 Prometheus 了。

在 K8s 集群上安裝 Prometheus Helm Chart

要在 K8s 集群上安裝 Prometheus Helm Chart,請運行以下helm install命令:

helm install prometheus prometheus-community/prometheus

輸出結(jié)果:

NAME: my-prometheus
LAST DEPLOYED: Thu Oct 12 20:06:57 2023
NAMESPACE: monitoring
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:
my-prometheus-server.monitoring.svc.cluster.local




Get the Prometheus server URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/name=prometheus,app.kubernetes.io/instance=my-prometheus" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace monitoring port-forward $POD_NAME 9090




The Prometheus alertmanager can be accessed via port 9093 on the following DNS name from within your cluster:
my-prometheus-alertmanager.monitoring.svc.cluster.local




Get the Alertmanager URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/name=alertmanager,app.kubernetes.io/instance=my-prometheus" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace monitoring port-forward $POD_NAME 9093
#################################################################################
######   WARNING: Pod Security Policy has been disabled by default since    #####
######            it deprecated after k8s 1.25+. use                        #####
######            (index .Values "prometheus-node-exporter" "rbac"          #####
###### .          "pspEnabled") with (index .Values                         #####
######            "prometheus-node-exporter" "rbac" "pspAnnotations")       #####
######            in case you still need it.                                #####
#################################################################################




The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster:
my-prometheus-prometheus-pushgateway.monitoring.svc.cluster.local




Get the PushGateway URL by running these commands in the same shell:
  export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus-pushgateway,component=pushgateway" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace monitoring port-forward $POD_NAME 9091


For more information on running Prometheus, visit:
https://prometheus.io/

現(xiàn)在我們已經(jīng)在 Kubernetes 集群上安裝了 Prometheus。我們可以通過80端口訪問 Prometheus 服務(wù)器。下一步是查看部署的 Kubernetes 資源,也就是 Helm Chart 在 Kubernetes 集群中創(chuàng)建的 Pod 和服務(wù)。

要查看已部署的 Kubernetes 資源,請運行以下kubectl命令:

kubectl get all

輸出結(jié)果:

NAME                                                        READY   STATUS    RESTARTS   AGE
pod/my-prometheus-prometheus-node-exporter-d5l8m            1/1     Running   0          27m
pod/my-prometheus-prometheus-node-exporter-kfbxb            1/1     Running   0          27m
pod/my-prometheus-prometheus-pushgateway-86d6f795cb-mlb7d   1/1     Running   0          27m
pod/my-prometheus-kube-state-metrics-6c4b65c7b9-wbh9r       1/1     Running   0          27m
pod/my-prometheus-prometheus-node-exporter-2z7rp            1/1     Running   0          27m
pod/my-prometheus-alertmanager-0                            1/1     Running   0          27m
pod/my-prometheus-server-795d8fc685-zcfct                   2/2     Running   0          27m


NAME                                             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/my-prometheus-alertmanager-headless      ClusterIP   None                    9093/TCP   27m
service/my-prometheus-server                     ClusterIP   10.43.186.10            80/TCP     27m
service/my-prometheus-prometheus-pushgateway     ClusterIP   10.43.154.83            9091/TCP   27m
service/my-prometheus-alertmanager               ClusterIP   10.43.217.41            9093/TCP   27m
service/my-prometheus-kube-state-metrics         ClusterIP   10.43.168.65            8080/TCP   27m
service/my-prometheus-prometheus-node-exporter   ClusterIP   10.43.195.241           9100/TCP   27m


NAME                                                    DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
daemonset.apps/my-prometheus-prometheus-node-exporter   3         3         3       3            3           kubernetes.io/os=linux   27m


NAME                                                   READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/my-prometheus-prometheus-pushgateway   1/1     1            1           27m
deployment.apps/my-prometheus-kube-state-metrics       1/1     1            1           27m
deployment.apps/my-prometheus-server                   1/1     1            1           27m


NAME                                                              DESIRED   CURRENT   READY   AGE
replicaset.apps/my-prometheus-prometheus-pushgateway-86d6f795cb   1         1         1       27m
replicaset.apps/my-prometheus-kube-state-metrics-6c4b65c7b9       1         1         1       27m
replicaset.apps/my-prometheus-server-795d8fc685                   1         1         1       27m


NAME                                          READY   AGE
statefulset.apps/my-prometheus-alertmanager   1/1     27m

安裝 Helm Chart 會創(chuàng)建以下 Kubernetes 資源:

Pod:托管集群內(nèi)已部署的 Prometheus Kubernetes 應(yīng)用程序。

Replica Sets:Kubernetes 集群內(nèi)同一應(yīng)用程序?qū)嵗募?。它提高了?yīng)用程序的可靠性。

Deployments:這是創(chuàng)建應(yīng)用程序 Pod 的藍圖。

Services:這是公開 Kubernetes 集群內(nèi)運行的 Pod。我們用它來訪問已部署的 Kubernetes 應(yīng)用程序。

下一步是訪問并啟動 Prometheus Kubernetes 應(yīng)用程序。這里將使用 Prometheus 的 Kubernetes 服務(wù)訪問該應(yīng)用程序。要獲取 Prometheus 的所有 Kubernetes 服務(wù),請運行以下命令:

kubectl get service

輸出結(jié)果:


NAME                                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
my-prometheus-alertmanager-headless      ClusterIP   None                    9093/TCP   28m
my-prometheus-server                     ClusterIP   10.43.186.10            80/TCP     28m
my-prometheus-prometheus-pushgateway     ClusterIP   10.43.154.83            9091/TCP   28m
my-prometheus-alertmanager               ClusterIP   10.43.217.41            9093/TCP   28m
my-prometheus-kube-state-metrics         ClusterIP   10.43.168.65            8080/TCP   28m
my-prometheus-prometheus-node-exporter   ClusterIP   10.43.195.241           9100/TCP   28m

輸出結(jié)果列出了 Prometheus 的下列 K8s service:

prometheus-alertmanager

prometheus-alertmanager-headless

prometheus-kube-state-metrics

prometheus-prometheus-node-exporter

prometheus-prometheus-pushgateway

prometheus-server

我們將使用prometheus-serverKubernetes service 來訪問 Prometheus 應(yīng)用程序。prometheus-server是 ClusterIP 類型。您只能在 Kubernetes 集群內(nèi)訪問它。因此我們需要公開這個 Kubernetes service,以便在 Kubernetes 集群外部訪問它。公開prometheus-serverKubernetes service 將生成一個 URL。我們可以在瀏覽器上加載 URL 并訪問正在運行的應(yīng)用程序。

公開 prometheus-server Kubernetes service

要公開prometheus-serverKubernetes service,請運行以下命令:

kubectl expose service prometheus-server --type=NodePort --target-port=9090 --name=prometheus-server-ext

該命令會將ClusterIP類型轉(zhuǎn)換為NodePort類型。這樣,prometheus-server就能在 Kubernetes 集群之外通過 9090 端口訪問。

現(xiàn)在,我們公開了prometheus-serverKubernetes service。接下來使用以下命令訪問 Prometheus 應(yīng)用程序:

minikube service prometheus-server-ext

該命令生成以下 URL:

19b48574-af98-11ee-8b88-92fbcf53809c.jpg

URL 可能需要稍等一會兒才可用。您需要在瀏覽器上進行多次重試,直到使用此 URL 訪問 Prometheus Kubernetes 應(yīng)用程序。您還需要保持終端打開并運行命令,以便繼續(xù)訪問服務(wù)。

19c90238-af98-11ee-8b88-92fbcf53809c.jpg

到這里,我們已經(jīng)成功使用 Helm 在 Kubernetes 上安裝了 Prometheus。Prometheus 已經(jīng)在集群內(nèi)部運行,我們可以使用瀏覽器或 URL 來進行訪問。

鏈接:https://blog.51cto.com/u_15682575/9174831






審核編輯:劉清

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • Linux系統(tǒng)
    +關(guān)注

    關(guān)注

    4

    文章

    608

    瀏覽量

    29505
  • URL
    URL
    +關(guān)注

    關(guān)注

    0

    文章

    141

    瀏覽量

    16076

原文標(biāo)題:如何使用 Helm 在 K8s 上集成 Prometheus

文章出處:【微信號:magedu-Linux,微信公眾號:馬哥Linux運維】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。

收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    什么是 K8S,如何使用 K8S

    Kubernetes(簡稱K8S)是一個用于管理容器化應(yīng)用程序的開源平臺。以下是關(guān)于K8S及其使用方法的介紹: 一、什么是 K8S 核心特點 自動化容器編排:自動處理容器的部署、擴展、負載均衡
    發(fā)表于 06-25 06:45

    使用Helm 容器服務(wù)k8s集群一鍵部署wordpress

    新的chartchart打包成tgz格式上傳chart到chart倉庫或從倉庫中下載chartKubernetes集群中安裝或卸載chart管理用Helm安裝的chart的發(fā)布周期Helm有三個重要概念:chart
    發(fā)表于 03-29 13:38

    OpenStack與K8s結(jié)合的兩種方案的詳細介紹和比較

    OpenStack與K8S結(jié)合主要有兩種方案。一是K8S部署OpenStack平臺之上,二是K8S和OpenStack組件集成。
    的頭像 發(fā)表于 10-14 09:38 ?2.8w次閱讀

    Docker不香嗎為什么還要用K8s

    Docker 雖好用,但面對強大的集群,成千上萬的容器,突然感覺不香了。 這時候就需要我們的主角 Kubernetes 上場了,先來了解一下 K8s 的基本概念,后面再介紹實踐,由淺入深步步為營
    的頭像 發(fā)表于 06-02 11:56 ?3875次閱讀

    簡單說明k8s和Docker之間的關(guān)系

    ,但最近發(fā)現(xiàn)k8s概念較多,命令也有些不夠用了,故想借此機會寫點東西,更全面認識并使用k8s。本篇文章目的:讓你更全面了解k8s概念,以及學(xué)到在工作中常用的操作。整體更偏向于原理和應(yīng)用。
    的頭像 發(fā)表于 06-24 15:48 ?3925次閱讀

    K8S集群服務(wù)訪問失敗怎么辦 K8S故障處理集錦

    問題1:K8S集群服務(wù)訪問失敗? ? ? 原因分析:證書不能被識別,其原因為:自定義證書,過期等。 解決方法:更新證書即可。 問題2:K8S集群服務(wù)訪問失敗? curl: (7) Failed
    的頭像 發(fā)表于 09-01 11:11 ?1.7w次閱讀
    <b class='flag-5'>K8S</b>集群服務(wù)訪問失敗怎么辦 <b class='flag-5'>K8S</b>故障處理集錦

    K8S(kubernetes)學(xué)習(xí)指南

    K8S(kubernetes)學(xué)習(xí)指南
    發(fā)表于 06-29 14:14 ?0次下載

    mysql部署k8s上的實現(xiàn)方案

    的 RDBMS (Relational Database Management System,關(guān)系數(shù)據(jù)庫管理系統(tǒng)) 應(yīng)用軟件之一。這里主要講 mysql 部署 k8s 上,mysql 部署
    的頭像 發(fā)表于 09-26 10:39 ?3028次閱讀

    K8s+SpringBoot實現(xiàn)零宕機發(fā)布

    K8s + SpringBoot實現(xiàn)零宕機發(fā)布:健康檢查+滾動更新+優(yōu)雅停機+彈性伸縮+Prometheus監(jiān)控+配置分離(鏡像復(fù)用)。
    的頭像 發(fā)表于 01-31 16:31 ?1345次閱讀

    k8s是什么意思?kubeadm部署k8s集群(k8s部署)|PetaExpres

    ),Kubernetes提供了應(yīng)用部署,規(guī)劃,更新,維護的一種機制。 Kubernetes中,我們可以創(chuàng)建多個容器,每個容器里面運行一個應(yīng)用實例,然后通過內(nèi)置的負載均衡策略,實現(xiàn)對這一組應(yīng)用實例的管理、發(fā)現(xiàn)、訪問,而這些細節(jié)都不需要運維人員去進行復(fù)雜的手工配置和處理。 kubernetes(
    發(fā)表于 07-19 13:14 ?1487次閱讀

    什么是K3sK8s?K3sK8s有什么區(qū)別?

    Kubernetes,通??s寫為 K8s,是領(lǐng)先的容器編排工具。該開源項目最初由 Google 開發(fā),幫助塑造了現(xiàn)代編排的定義。該系統(tǒng)包括了部署和運行容器化系統(tǒng)所需的一切。
    的頭像 發(fā)表于 08-03 10:53 ?8900次閱讀

    k8s生態(tài)鏈包含哪些技術(shù)

    1. Apache APISIX Ingress 定義 ? K8s 生態(tài)中,Ingress 作為表示 K8s 流量入口的一種資源,想要讓其生效,就需要有一個 Ingress Controller
    的頭像 發(fā)表于 08-07 10:56 ?1810次閱讀
    <b class='flag-5'>k8s</b>生態(tài)鏈包含哪些技術(shù)

    k8s云原生開發(fā)要求

    Kubernetes(K8s)云原生開發(fā)對硬件有一定要求。CPU方面,建議至少配備2個邏輯核心,高性能CPU更佳。內(nèi)存至少4GB,但8GB或更高更推薦。存儲需至少20-30GB可用空間,SSD提升
    的頭像 發(fā)表于 10-24 10:03 ?910次閱讀
    <b class='flag-5'>k8s</b>云原生開發(fā)要求

    k8s和docker區(qū)別對比,哪個更強?

    Docker和Kubernetes(K8s)是容器化技術(shù)的兩大流行工具。Docker關(guān)注構(gòu)建和打包容器,適用于本地開發(fā)和單主機管理;而K8s則提供容器編排和管理平臺,適用于多主機或云環(huán)境,具備自動化
    的頭像 發(fā)表于 12-11 13:55 ?1012次閱讀

    K8s存儲類設(shè)計與Ceph集成實戰(zhàn)

    云原生時代,存儲是制約應(yīng)用性能的關(guān)鍵瓶頸。本文將帶你深入理解K8s存儲類的設(shè)計原理,并手把手實現(xiàn)與Ceph的完美集成,讓你的集群存儲性能提升300%!
    的頭像 發(fā)表于 08-22 11:50 ?513次閱讀