<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Monitoring Kubernetes > 原文:[https://docs.gitlab.com/ee/user/project/integrations/prometheus_library/kubernetes.html](https://docs.gitlab.com/ee/user/project/integrations/prometheus_library/kubernetes.html) * [Requirements](#requirements) * [Metrics supported](#metrics-supported) * [Configuring Prometheus to monitor for Kubernetes metrics](#configuring-prometheus-to-monitor-for-kubernetes-metrics) * [Specifying the Environment](#specifying-the-environment) * [Displaying Canary metrics](#displaying-canary-metrics-premium) * [Canary metrics supported](#canary-metrics-supported) # Monitoring Kubernetes[](#monitoring-kubernetes "Permalink") 在 GitLab 9.0 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8935) . GitLab 支持自動檢測和監視 Kubernetes 指標. ## Requirements[](#requirements "Permalink") 必須啟用[Prometheus](../prometheus.html)和[Kubernetes](../kubernetes.html)集成服務. ## Metrics supported[](#metrics-supported "Permalink") * 平均內存使用量(MB): ``` avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) / count(avg(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) without (job)) /1024/1024 ``` * 平均 CPU 使用率(%): ``` avg(sum(rate(container_cpu_usage_seconds_total{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}[15m])) by (job)) without (job) / count(sum(rate(container_cpu_usage_seconds_total{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}[15m])) by (pod_name)) ``` ## Configuring Prometheus to monitor for Kubernetes metrics[](#configuring-prometheus-to-monitor-for-kubernetes-metrics "Permalink") 為了收集 Kubernetes 指標,需要將 Prometheus 部署到集群中并進行正確配置. GitLab 支持兩種方法: * GitLab [與 Kubernetes 集成](../../clusters/index.html) ,并且可以[將 Prometheus 部署到連接的集群中](../prometheus.html#managed-prometheus-on-kubernetes) . 它被自動配置為收集 Kubernetes 指標. * 要配置自己的 Prometheus 服務器,可以遵循[Prometheus 文檔](https://s0prometheus0io.icopy.site/docs/introduction/overview/) . ## Specifying the Environment[](#specifying-the-environment "Permalink") 為了隔離并僅顯示給定環境的相關 CPU 和內存指標,GitLab 需要一種方法來檢測其正在運行的容器. 由于這些指標是在容器級別跟蹤的,因此傳統的 Kubernetes 標簽不可用. 相反, [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)或[DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/)名稱應以[CI_ENVIRONMENT_SLUG 開頭](../../../../ci/variables/README.html#predefined-environment-variables) . 如果需要,可以在其后跟一個`-`和其他內容. 例如, `review-homepage-5620p5`的部署名稱將與`review/homepage`環境匹配. ## Displaying Canary metrics[](#displaying-canary-metrics-premium "Permalink") 在[GitLab 10.2 中](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/15201)引入. GitLab 還收集了針對[Canary 部署的](../../canary_deployments.html) Kubernetes 指標,從而可以輕松比較當前部署的版本和 Canary. 這些度量標準期望[Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)或[DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/)名稱以`$CI_ENVIRONMENT_SLUG-canary`開頭,以隔離 canary 度量標準. ### Canary metrics supported[](#canary-metrics-supported "Permalink") * 平均內存使用量(MB) ``` avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-canary-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) / count(avg(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-canary-(.*)",namespace="%{kube_namespace}"}) without (job)) /1024/1024 ``` * 平均 CPU 使用率(%) ``` avg(sum(rate(container_cpu_usage_seconds_total{container_name!="POD",pod_name=~"^%{ci_environment_slug}-canary-(.*)",namespace="%{kube_namespace}"}[15m])) by (job)) without (job) / count(sum(rate(container_cpu_usage_seconds_total{container_name!="POD",pod_name=~"^%{ci_environment_slug}-canary-(.*)",namespace="%{kube_namespace}"}[15m])) by (pod_name)) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看