• kubernetes 1.21部署 kubeprometheus


    https://github.com/prometheus-operator/kube-prometheus

    1. helm方式

    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    helm repo update
    helm search repo prometheus-community
    
    # helm env
    HELM_BIN="helm"
    HELM_CACHE_HOME="/root/.cache/helm"
    HELM_CONFIG_HOME="/root/.config/helm"
    HELM_DATA_HOME="/root/.local/share/helm"
    HELM_DEBUG="false"
    HELM_KUBEAPISERVER=""
    HELM_KUBEASGROUPS=""
    HELM_KUBEASUSER=""
    HELM_KUBECAFILE=""
    HELM_KUBECONTEXT=""
    HELM_KUBETOKEN=""
    HELM_MAX_HISTORY="10"
    HELM_NAMESPACE="default"
    HELM_PLUGINS="/root/.local/share/helm/plugins"
    HELM_REGISTRY_CONFIG="/root/.config/helm/registry.json"
    HELM_REPOSITORY_CACHE="/root/.cache/helm/repository"
    HELM_REPOSITORY_CONFIG="/root/.config/helm/repositories.yaml"
    
    cat /root/.cache/helm/repository/prometheus-community-index.yaml |grep tgz
    确保tgz文件可下载
    
    helm install stable prometheus-community/kube-prometheus-stack
    
    kubectl get pod
    kubectl get service
    
    kubectl edit service stable-kube-prometheus-sta-prometheus
    kubectl edit service stable-grafana
    修改 type: LoadBalancer
    
    kubectl get service
    
    UserName: admin
    Password: prom-operator
    

    2. kubeadm方式

    git clone -b v0.9.0 https://hub.fastgit.org/prometheus-operator/kube-prometheus.git
    
    sed -e 's|image: quay.io|image: 192.168.100.198:5000|g' \
        -e 's|image: k8s.gcr.io|image: 192.168.100.198:5000|g' \
        -e 's|image: jimmidyson|image: 192.168.100.198:5000/jimmidyson|g' \
        -e 's|image: grafana|image: 192.168.100.198:5000/grafana|g' \
        -i /root/kube-prometheus/manifests/*.yaml
    
    sed -e 's|image: quay.io|image: 192.168.100.198:5000|g' -i /root/kube-prometheus/manifests/setup/*.yaml
    
    cd kube-prometheus
    
    kubectl create -f manifests/setup
    kubectl create -f manifests/
    
    kubectl edit service grafana -n monitoring
    kubectl edit service prometheus-k8s -n monitoring
    修改 type: LoadBalancer
    
    # kubectl get namespace -A
    NAME                   STATUS   AGE
    default                Active   32d
    ingress-nginx          Active   32d
    kube-node-lease        Active   32d
    kube-public            Active   32d
    kube-system            Active   32d
    kubernetes-dashboard   Active   32d
    metallb-system         Active   32d
    monitoring             Active   6m13s
    
    # kubectl get pod -n monitoring
    NAME                                   READY   STATUS    RESTARTS   AGE
    alertmanager-main-0                    2/2     Running   0          4m39s
    alertmanager-main-1                    2/2     Running   0          4m39s
    alertmanager-main-2                    2/2     Running   0          4m39s
    blackbox-exporter-655c658fb6-dw64k     3/3     Running   0          4m39s
    grafana-6c5697484d-qxf7x               1/1     Running   0          4m38s
    kube-state-metrics-7557977c4c-9ms2r    3/3     Running   0          4m38s
    node-exporter-52mxt                    2/2     Running   0          4m38s
    node-exporter-h9tzg                    2/2     Running   0          4m38s
    node-exporter-l6f6f                    2/2     Running   0          4m38s
    node-exporter-l9xc7                    2/2     Running   0          4m38s
    node-exporter-nn56w                    2/2     Running   0          4m38s
    node-exporter-sqk87                    2/2     Running   0          4m38s
    prometheus-adapter-5bd7ff6468-6tmdf    1/1     Running   0          4m37s
    prometheus-adapter-5bd7ff6468-ljhxk    1/1     Running   0          4m37s
    prometheus-k8s-0                       2/2     Running   0          4m36s
    prometheus-k8s-1                       2/2     Running   0          4m36s
    prometheus-operator-587f484b85-twksp   2/2     Running   0          6m52s
    
    # kubectl get service -n monitoring
    NAME                    TYPE           CLUSTER-IP       EXTERNAL-IP       PORT(S)                      AGE
    alertmanager-main       ClusterIP      10.96.207.31     <none>            9093/TCP                     4m50s
    alertmanager-operated   ClusterIP      None             <none>            9093/TCP,9094/TCP,9094/UDP   4m50s
    blackbox-exporter       ClusterIP      10.101.213.122   <none>            9115/TCP,19115/TCP           4m50s
    grafana                 LoadBalancer   10.98.70.89      192.168.100.162   3000:32358/TCP               4m49s
    kube-state-metrics      ClusterIP      None             <none>            8443/TCP,9443/TCP            4m49s
    node-exporter           ClusterIP      None             <none>            9100/TCP                     4m49s
    prometheus-adapter      ClusterIP      10.104.121.198   <none>            443/TCP                      4m49s
    prometheus-k8s          LoadBalancer   10.100.136.202   192.168.100.163   9090:31918/TCP               4m48s
    prometheus-operated     ClusterIP      None             <none>            9090/TCP                     4m48s
    prometheus-operator     ClusterIP      None             <none>            8443/TCP                     7m3s
    
    http://192.168.100.162:3000/login
    account: admin / admin
    
    http://192.168.100.163:9090
    
    kubectl delete --ignore-not-found=true -f manifests/ -f manifests/setup
    
  • 相关阅读:
    bat 实现主机hostname的修改
    我的影视作品,如何在博客园发布带有CSS样式的HTML
    java实现Windows记事本
    cmd 执行Dcpromo错误:在该 SKU 上不支持 Active Directory 域服务安装向导,Windows Server 2008 R2 Enterprise 配置AD(Active Directory)域控制器
    警告: 正保存的数据被裁断到 1024 字符。 错误: 拒绝访问注册表路径。
    山西大同大学教务处教师端——可在PC端,手机端操作
    bat脚本+diskpart 脚本实现自动划分磁盘分区
    山西大同大学教务处学生端--送给学弟,学妹的礼物,可在PC端,手机端操作
    ECharts
    javascript删除数组里的对象
  • 原文地址:https://www.cnblogs.com/liujitao79/p/15597302.html
Copyright © 2020-2023  润新知