快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

Kubernetes1.8.4中如何安装Heapster

这篇文章给大家分享的是有关Kubernetes 1.8.4中如何安装Heapster的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

站在用户的角度思考问题,与客户深入沟通,找到河曲网站设计与河曲网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站设计、网站制作、外贸营销网站建设、企业官网、英文网站、手机端网站、网站推广、空间域名、网络空间、企业邮箱。业务覆盖河曲地区。

Heapster

      Heapster 是 Kubernetes 社区维护的容器集群监控分析工具。Heapster 会从 Kubernetes apiserver 获得所有 Node 信息,然后再通过这些 Node 来获得 kubelet 上的数据,最后再将所有收集到数据送到 Heapster 的后台储存 InfluxDB,最后利用 Grafana 来抓取 InfluxDB 的数据源来进行可视化。

  • 在master通过 kubectl 来创建 kubernetes monitor 即可
    生成kube-heapster.yml

    cat < kube-heapster.yml
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: heapster-sa
      namespace: kube-system
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: heapster-binding
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: system:heapster
    subjects:
    - kind: ServiceAccount
      name: heapster
      namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
      name: system:pod-nanny
      namespace: kube-system
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    rules:
    - apiGroups:
      - ""
      resources:
      - pods
      verbs:
      - get
    - apiGroups:
      - "extensions"
      resources:
      - deployments
      verbs:
      - get
      - update
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      name: heapster-binding
      namespace: kube-system
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: Role
      name: system:pod-nanny
    subjects:
    - kind: ServiceAccount
      name: heapster
      namespace: kube-system
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: heapster
      namespace: kube-system
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    spec:
      ports:
        - port: 80
          targetPort: 8082
      selector:
        k8s-app: heapster
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: monitoring-grafana
      namespace: kube-system
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    spec:
      ports:
        - port: 80
          protocol: TCP
          targetPort: ui
      selector:
        k8s-app: influxGrafana
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: monitoring-influxdb
      namespace: kube-system
      labels:
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    spec:
      ports:
        - name: http
          port: 8083
          targetPort: 8083
        - name: api
          port: 8086
          targetPort: 8086
      selector:
        k8s-app: influxGrafana
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: heapster
      labels:
        k8s-app: heapster
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
      namespace: kube-system
    spec:
      replicas: 1
      selector:
        matchLabels:
          k8s-app: heapster
      template:
        metadata:
          labels:
            k8s-app: heapster
          annotations:
            scheduler.alpha.kubernetes.io/critical-pod: ''
        spec:
          serviceAccountName: heapster-sa
          tolerations:
          - key: node-role.kubernetes.io/master
            effect: NoSchedule
          - key: "CriticalAddonsOnly"
            operator: "Exists"
          containers:
            - image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-amd64:v1.5.0-beta.0
              name: heapster
              livenessProbe:
                httpGet:
                  path: /healthz
                  port: 8082
                  scheme: HTTP
                initialDelaySeconds: 180
                timeoutSeconds: 5
              command:
                - /heapster
                - --source=kubernetes.summary_api:''
                - --sink=influxdb:http://monitoring-influxdb:8086
            - image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-amd64:v1.5.0-beta.0
              name: eventer
              command:
                - /eventer
                - --source=kubernetes:''
                - --sink=influxdb:http://monitoring-influxdb:8086
            - image: registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.7
              name: heapster-nanny
              resources:
                limits:
                  cpu: 100m
                  memory: 128Mi
                requests:
                  cpu: 50m
                  memory: 90Mi
              env:
                - name: MY_POD_NAME
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.name
                - name: MY_POD_NAMESPACE
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.namespace
              command:
                - /pod_nanny
                - --cpu=80m
                - --extra-cpu=0.5m
                - --memory=140Mi
                - --extra-memory=4Mi
                - --threshold=5
                - --deployment=heapster
                - --container=heapster
                - --poll-period=300000
                - --estimator=exponential
            - image: registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.7
              name: eventer-nanny
              resources:
                limits:
                  cpu: 100m
                  memory: 128Mi
                requests:
                  cpu: 50m
                  memory: 90Mi
              env:
                - name: MY_POD_NAME
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.name
                - name: MY_POD_NAMESPACE
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.namespace
              command:
                - /pod_nanny
                - --cpu=100m
                - --extra-cpu=0m
                - --memory=190Mi
                - --extra-memory=500Ki
                - --threshold=5
                - --deployment=heapster
                - --container=eventer
                - --poll-period=300000
                - --estimator=exponential
    ---
    kind: Deployment
    apiVersion: extensions/v1beta1
    metadata:
      name: influxdb-grafana
      namespace: kube-system
      labels:
        k8s-app: influxGrafana
        kubernetes.io/cluster-service: "true"
        addonmanager.kubernetes.io/mode: Reconcile
    spec:
      replicas: 1
      selector:
        matchLabels:
          k8s-app: influxGrafana
      template:
        metadata:
          labels:
            k8s-app: influxGrafana
          annotations:
            scheduler.alpha.kubernetes.io/critical-pod: ''
        spec:
          tolerations:
          - key: node-role.kubernetes.io/master
            effect: NoSchedule
          - key: "CriticalAddonsOnly"
            operator: "Exists"
          containers:
            - name: influxdb
              image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-influxdb-amd64:v1.3.3
              resources:
                limits:
                  cpu: 100m
                  memory: 500Mi
                requests:
                  cpu: 100m
                  memory: 500Mi
              ports:
                - name: http
                  containerPort: 8083
                - name: api
                  containerPort: 8086
              volumeMounts:
              - name: influxdb-persistent-storage
                mountPath: /data
            - name: grafana
              image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-grafana-amd64:v4.4.3
              env:
              resources:
                limits:
                  cpu: 100m
                  memory: 100Mi
                requests:
                  cpu: 100m
                  memory: 100Mi
              env:
                - name: INFLUXDB_SERVICE_URL
                  value: http://monitoring-influxdb:8086
                - name: GF_AUTH_BASIC_ENABLED
                  value: "false"
                - name: GF_AUTH_ANONYMOUS_ENABLED
                  value: "true"
                - name: GF_AUTH_ANONYMOUS_ORG_ROLE
                  value: Admin
                - name: GF_SERVER_ROOT_URL
                  value: /api/v1/proxy/namespaces/kube-system/services/monitoring-grafana/
              ports:
              - name: ui
                containerPort: 3000
                protocol: TCP
              volumeMounts:
              - name: grafana-persistent-storage
                mountPath: /var
          volumes:
          - name: influxdb-persistent-storage
            emptyDir: {}
          - name: grafana-persistent-storage
            emptyDir: {}
    EOF

    kubectl apply -f kube-heapster.yml

    查看状态

    kubectl -n kube-system get po,svc

    完成后,就可以通过浏览器访问Grafana Dashboard

    https://10.0.0.162:6443/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana

感谢各位的阅读!关于“Kubernetes 1.8.4中如何安装Heapster”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!


本文名称:Kubernetes1.8.4中如何安装Heapster
链接URL:http://6mz.cn/article/jepgip.html

其他资讯