kubernetes安装heapster、influxdb及grafana

下载yaml

在这里下载deploy/kube-config/influxdb

修改yaml

  • 替换镜像

gcr.io/google_containers/heapster-grafana:v4.0.2
registry.cn-hangzhou.aliyuncs.com/kube_containers/heapster_grafana

gcr.io/google_containers/heapster-influxdb:v1.1.1
registry.cn-hangzhou.aliyuncs.com/kube_containers/heapster_influxdb

gcr.io/google_containers/heapster:v1.3.0-beta.0
registry.cn-hangzhou.aliyuncs.com/wayne/heapster:v1.1.0
  • 修改grafana-service.yaml
    添加external ip,同时把port由80改为3000。因为80的port跟heapster-service.yaml中的80的port冲突了。

apiVersion: v1
kind: Service
metadata:
  labels:
    # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
    # If you are NOT using this as an addon, you should comment out this line.
    kubernetes.io/cluster-service: 'true'
    kubernetes.io/name: monitoring-grafana
  name: monitoring-grafana
  namespace: kube-system
spec:
  # In a production setup, we recommend accessing Grafana through an external Loadbalancer
  # or through a public IP.
  # type: LoadBalancer
  # You could also use NodePort to expose the service at a randomly-generated port
  # type: NodePort
  ports:
  - port: 3000
    targetPort: 3000
  selector:
    k8s-app: grafana
  externalIPs: 
    - 192.168.99.101   
  • 修改influxdb-service.yaml
    新增8083的port暴露出来,同时添加external ip

apiVersion: v1
kind: Service
metadata:
  labels:
    task: monitoring
    # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
    # If you are NOT using this as an addon, you should comment out this line.
    kubernetes.io/cluster-service: 'true'
    kubernetes.io/name: monitoring-influxdb
  name: monitoring-influxdb
  namespace: kube-system
spec:
  ports:
  - name: http
    port: 8083
    targetPort: 8083
  - name: api
    port: 8086
    targetPort: 8086
  selector:
    k8s-app: influxdb
  externalIPs: 
    - 192.168.99.101  

创建

kubectl create -f deploy/kube-config/influxdb/

配置grafana

http://192.168.99.101:3000/
修改下k8s数据源的url

clipboard.png

查看数据

clipboard.png

doc

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装 Prometheus 和 Grafana 可以通过 Kubernetes 的 Helm 包管理器来完成。以下是安装步骤: 1. 首先,确保已经安装了 Helm 包管理器。可以在命令行中运行以下命令来检查是否已安装 Helm: ``` helm version ``` 2. 接下来,添加 Prometheus 和 Grafana 的 Helm 存储库。运行以下命令: ``` helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo add grafana https://grafana.github.io/helm-charts helm repo update ``` 3. 安装 Prometheus。运行以下命令: ``` helm install prometheus prometheus-community/kube-prometheus-stack ``` 这将安装 Prometheus 和 Grafana,并且会创建一个新的 Kubernetes 命名空间来运行它们。 4. 等待安装完成后,可以使用以下命令查看安装的 Pod: ``` kubectl get pods -n prometheus ``` 5. 安装 Grafana。运行以下命令: ``` helm install grafana grafana/grafana ``` 6. 等待安装完成后,可以使用以下命令查看安装的 Pod: ``` kubectl get pods -n grafana ``` 7. 最后,可以通过浏览器访问 Grafana 的 Web 界面。默认情况下,Grafana 的服务类型为 ClusterIP,意味着它只能从 Kubernetes 集群内的其他 Pod 访问。为了从外部访问 Grafana,需要将其服务类型更改为 LoadBalancer。可以使用以下命令来更改服务类型: ``` kubectl patch service grafana -n grafana -p '{"spec":{"type":"LoadBalancer"}}' ``` 等待一段时间后,可以使用以下命令查看 Grafana 的外部 IP 地址: ``` kubectl get service grafana -n grafana ``` 然后,在浏览器中输入该 IP 地址即可访问 Grafana。 希望这可以帮助你安装 Prometheus 和 Grafana
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值