安装 Helm 和 Prometheus
安装 Helm
将以下命令复制后粘贴到终端:
install_helmv3() {if ! hash wget &>/dev/null;thenif grep 'Ubuntu' /etc/os-release &>/dev/null;thenapt install wget -yelseyum install wget -yfifiwget http://ops.dosec.cn/directlink/tools/helm-v3.3.0-linux-amd64.tar.gztar xf helm-v3.3.0-linux-amd64.tar.gzcp linux-amd64/helm /usr/local/binrm -rf linux-amd64# helm completionecho "source <(helm completion bash)" >> ~/.bashrcexec $SHELL -l}init_helmv3() {# 添加阿里云 APPHub 和微软 Azure 提供的 Charts 镜像# helm repo add local http://127.0.0.1:8879/charts# v2 版本默认会增加上面这个本地 repo, 这里记录一下备用helm repo add stable https://apphub.aliyuncs.comhelm repo add azure http://mirror.azure.cn/kubernetes/charts/helm repo add incubator http://mirror.azure.cn/kubernetes/charts/# 更新本地 charts repohelm repo update}
安装 Helmv3
install_helmv3
初始化 Helm 仓库
init_helmv3
安装 Prometheus
创建命名空间
kubectl create namespace monitoring
安装 Prometheus
helm install monitor --namespace monitoring stable/prometheus-operator --set 'grafana.adminPassword=bRmG9agqbdQUFUqw,grafana.service.type=NodePort,grafana.service.nodePort=3000'
访问监控界面
URL: 节点IP:3000
用户名: admin
密码: bRmG9agqbdQUFUqw
